question

AmanSingh-5167 avatar image
0 Votes"
AmanSingh-5167 asked ShwetaChoudhary-8869 answered

How to share a file in onedrive using API ?

I am currently my organization work account and using this API for sharing - https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite?view=odsp-graph-online

The request is successful but the shared user not able to see/find the file in its shared folder.

Is there any other way to do it or I am missing something here ?

Also, Is the API works differently for work accounts and personal accounts ?

microsoft-graph-permissions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ShwetaChoudhary-8869 avatar image
0 Votes"
ShwetaChoudhary-8869 answered

Thank you for reaching out.

Few things that could help here -
1. Try accessing the shared drive items as described here.
2. Do keep in mind, for OneDrive for Business and SharePoint, the Shares API always requires authentication and cannot be used to access anonymously shared content without a user context.
3. Check the roles that are to be granted to the recipients of the sharing invitation. Do note that drives with a driveType of personal (OneDrive personal) cannot create or modify permissions on the root DriveItem.
4. Look out for 'sendInvitation' parameter in the request body. If true, a sharing link is sent to the recipient. Otherwise, permission is granted directly without sending a notification.

If this doesn't help, please reach out including details of an API call (timestamp, client request-id, request body, and response).




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.