I have 2 OneDrive Accounts. Account A shares a Folder with Account B. I am logged in with Account B and want to copy the shared Folder of Account A to a Folder in Account B via REST.
I know the OneDrive Live SDK Documentation says: https://msdn.microsoft.com/en-us/library/dn659743.aspx
The destination of a copy operation must be a folder. Folders themselves cannot be copied. Also, OneDrive storage is structured so that copy operations cannot occur between the OneDrive folder hierarchies of different users. For example, even if user A can read user B's files, user A cannot copy them to his or her own OneDrive folders.
I am not using the Live API https://apis.live.net/v5.0/
but the OneDrive API https://api.onedrive.com/v1.0/
When I copy Folder to Folder in my Own OneDrive, everything is fine:
POST https://api.onedrive.com/v1.0/drive/root:/test:/action.copy
Authorization: Bearer {ACCESS TOKEN}
Content-Type: application/json
Prefer: respond-async
{
"parentReference" : {"path": "/drive/root:/target"}
}
When I want to access the Folder of Account A via REST in Fiddler I get te following Error.
Rest Call:
POST https://api.onedrive.com/v1.0/drives/38A2C8D42D476A18/root:/test:/action.copy
Authorization: Bearer {ACCESS TOKEN}
Content-Type: application/json
Prefer: respond-async
{
"parentReference" : {"path": "/drive/root:/target"}
}
Error Response:
{"error":{"code":"itemNotFound","message":"Item does not exist"}}
The Scopes I use are:
- onedrive.readwrite
- wl.signin
- wl.skydrive
- wl.skydrive_update
- wl.contacts_skydrive