Pratik
Pratik

Reputation: 125

How to move files shared in OneDrive among drives

I am using Microsoft Graph perform file operations on data in OneDrive. I have gained the access token with appropriate scopes and permissions (Files.ReadWrite.All).

A OneDrive user has shared a folder with me, which contains some files. Another user has given me rights to a the folder. I'm trying to move those files into my OneDrive but it doesn't allow me to do so. The client software is able to perform this operation (it might be doing it copy and then delete operation).

However I can copy those shared files into my account, and then later delete the shared one but I want to use the move file API.

I'm requesting along with access token retrieved previously, the request looks like:

https://graph.microsoft.com/v1.0/me/drives/{drive_id}/items/{item-id}

and I'm getting following response:

{
  "error": {
       "code": "invalidRequest",
       "message": "Bad Argument",
       "innerError": {
           "request-id": "45d8b6a2-345a-44b7-a61e-abababababb",
           "date": "2017-12-11T11:22:29"
       }
   }
} 

Can someone please tell me which thing I'm missing?

Upvotes: 2

Views: 1073

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33094

This isn't a supported operation. You can only move a file within a single Drive, not from one Drive to another. From the documentation:

Items cannot be moved between Drives using this request.

Upvotes: 2

Related Questions