简体   繁体   中英

How can I get permissions for an item from OneDrive for Business using REST?

I have utilized the OneDrive JS picker and after the user selects an item, it will query for the permissions, using the route below, per the permissions reference .

GET: https://graph.microsoft.com/v1.0/drive/items/{item-id}/permissions

This works fine for items in personal OneDrive, but when working with items from OneDrive for business/sharepoint, the resulting HTTP response code is a 404 .

I tried using the domain of the sharepoint file (eg https://sample-my.sharepoint.com ) but that didn't work either. Is there a different domain that can be used?

I realize this is similar to Hanan Levy's question Get items permissions in OneDrive for Business using microsoft Graph API except that the response code I receive is 404 (File not found) while he reports the response has an error code and message (perhaps in response body).

EDIT : Per the request of Brad , below are the response headers Date and request-id , along with a screenshot containing the Request with response headers:

Date :Thu, 08 Dec 2016 19:02:47 GMT
request-id :3b2fe7b5-7ffc-4cc6-9853-e13150297186

screenshotOfRequestWithResponseHeaders

It looks like the call you're making is to https://tenant.sharepoint.com so I'm guessing you're trying to access the default document library for the tenant. However, the scopes you requested only include Files.ReadWrite which will only provide access to items in the caller's mysite. To access files outside of the caller's mysite you'll want to make sure to include Files.ReadWrite.All scope when you're creating the access token.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM