locked
SkyDrive REST API for COPY/MOVE RRS feed

  • Question

  • Hi All,

    I have a question. I want to use REST API to MOVE/COPY file on my skydrvie.

    But I cannot find any HTTPMethod.Move parameter.

    It is my code to COPY/MOVE file.

    async public Task<string> HTTPSelfCopy(string fileID)
            {
    
                string uri = string.Format("https://apis.live.net/v5.0/{0}", fileID);
                string data = null;
                
               Uri postUri = new Uri(uri, UriKind.Absolute);
               HttpClient client = new HttpClient();
               HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Put, uri);
               message.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _session.AccessToken);
               //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _session.AccessToken);
               HttpContent content = new StringContent(@"{""destination"":""" + _ID + @"""}");
               content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
               message.Content = content;
                var responseMessage = client.SendAsync(message).Result;
               if (responseMessage.StatusCode.Equals(HttpStatusCode.OK))
               {
                   data = await responseMessage.Content.ReadAsStringAsync();
               }
               else
               {
                   //error message
               }
                return data;
            }

    The HttpMethod only support GET, PUT, POST and DELETE. I cannot find any MOVE/COPY.

    I tried POST, it response 405 message.

    I tried PUT, it response 200. But there is not any file copy to other folder.

    Is anyone can answer my question.

    How could I use REST API for MOVE/COPY function?

    Thanks.

    Thursday, July 26, 2012 1:29 AM

Answers

All replies