File Movement API call stopped working suddenly

  • 1
  • Problem
  • Updated 2 months ago


We have written one console application in C# which uses Sharefile REST APIs. We have many operations like Download file, Create folder, Upload File, Delete file, Move file.
The console application is working fine from past 2 years.

But, Suddenly from yesterday the File movement part is not working. Api response is coming ok but file is not getting moved.

Below is the code of file movement which was working fine till now.

------------------------------------------------------------------------------------------------------------------
 try
 {
     String uri = string.Format("https://{0}/sf/v3/Items({1})?overwrite=true";, GetHostname(token), sourcefileid);
     Console.WriteLine(DateTime.Now + " : " + "Moving File " + filename );
     string json = @"{""Parent"":{""Id"":""" + destfolderid + @"""}}";
     HttpWebRequest request = WebRequest.CreateHttp(uri);
     addAuthorizationHeader(request, token);
     request.AllowAutoRedirect = false;
     request.Method = "PATCH";
     request.ContentType = "application/json";
     using (var writer = new StreamWriter(request.GetRequestStream()))
     {
         writer.Write(json);
         writer.Close();
     }
     HttpWebResponse response = (HttpWebResponse)request.GetResponse();
     response.Close();
 }
 catch (Exception e)
 {
     Console.WriteLine(DateTime.Now + " : " + "Unable to Move File " + filename +".Error: " + e);             
 }
------------------------------------------------------------------------------------------------------------------

Photo of Ashutosh Kumar

Ashutosh Kumar

  • 4 Posts
  • 0 Reply Likes

Posted 2 months ago

  • 1
Photo of Andy Berryman

Andy Berryman, Employee

  • 18 Posts
  • 5 Reply Likes
Can you please provide more detail about the response that is returned to you by the call?  A sample would be great.  What indicates to you that the move wasnt successful?  Does the response come back as a 200 with the body containing details for the Item?  Assuming so ... Do those details indicate the prior Parent rather than the new one that you requested?  Thanks.
Photo of Ashutosh Kumar

Ashutosh Kumar

  • 4 Posts
  • 0 Reply Likes

Photo of Andy Berryman

Andy Berryman, Employee

  • 18 Posts
  • 5 Reply Likes
What's actually in the body of the response?
Photo of Ashutosh Kumar

Ashutosh Kumar

  • 4 Posts
  • 0 Reply Likes
Is this the one you are referring to?

Photo of Andy Berryman

Andy Berryman, Employee

  • 18 Posts
  • 5 Reply Likes
Well ... I want to know what's in that Stream.  Basically I'm trying to see what the content of the error response is.  The only thing you've really provided to this point is just the HTTP Status Code.
-Andy