Is it possible to copy a shared folder to my own profile in OneDrive Business via Microsoft Graph API?
Both accounts are OneDrive Business Accounts. Account A shares a folder to Account B. Account B is logged in and can see all shared items from Account A. So Far so good.
How can I copy this shared folder to the profile of Account B?
When I try this POST I get a 401 - The caller is not authenticated.
POST https://graph.microsoft.com/v1.0/drives/<remoteItem.driveId>/items/<id>/copy
Content-Type: application/json
Authorization: Bearer xyz...
{
"parentReference": {
"path": "/drive/root:/Documents"
}
}
The scope I use is:
Any suggestions?
The copy API in OneDrive for Business and SharePoint is currently limited to copying files within the same "site". For OneDrive for Business each user is represented by a separate site, which means copying files between OneDrive's isn't supported.
We're working on adding the ability to copy files between sites and hope to have an update to the API available soon.