Hello MS Team,
I am working on a web based solution that should allow reading publicly shared OneDrive folder by organizational and anonymous users using MS Graph API. I use jQuery aJax to make requests to the API.
- I have created publicly shared OneDrive item with anyone with link can read and edit permissions. I can access and upload files to this link without logging in.
- I am trying to access this folder through MS Graph endpoints below. If I provide access token, everything works as expected. I can read permissions with scope : "anonymous" and type : "edit". However if user is not logged in and access token is absent, the MS Graph return 401 unauthorized response for each three requests.
GET https://graph.microsoft.com/v1.0/shares/{shareID}/driveID
GET https://graph.microsoft.com/v1.0/drives/{driveID}/items/{itemID}
POST https://graph.microsoft.com/v1.0/drives/{driveID}/items/{itemID}/createUploadSession
[@odata.context] => https://graph.microsoft.com/v1.0/$metadata#permission
[@odata.type] => #microsoft.graph.permission
[id] => 9c697ba7-65bb-4b4e-bbc2-****
[roles] => Array
(
[0] => write
)
[shareId] => u!aHR0cHM6Ly9zZWFn****
[hasPassword] =>
[link] => Array
(
[scope] => anonymous
[type] => edit
[webUrl] => https://{tenant}-my.sharepoint.com/:f:/g/personal/****/Ejj1aTBov-BFjqhJ***
[preventsDownload] =>
)
How is it possible to access publicly shared OneDrive folder when user is anonymous (i.e. when accessToken is not available)?
Alternatively - is it possible to create some kind of context token, than anonymous users can use to access publicly shared folders?