Get sharing permission for a file or folder
Return the effective sharing permission for a particular permission resource.
Effective permissions of an item can come from two sources: permissions set directly on the item itself or permissions that are inherited from the item's ancestors.
Callers can differentiate if the permission is inherited or not by checking the inheritedFrom
property.
This property is an ItemReference resource referencing the ancestor that the permission is inherited from.
SharePoint permission levels set on an item are returned with an 'SP' prefix. For example, SP.View Only, SP.Limited Access, SP.View Web Analytics Data. See Full list of SharePoint roles.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
Delegated (personal Microsoft account) | Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All |
Application | Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
HTTP request
GET /drives/{drive-id}/items/{item-id}/permissions/{perm-id}
GET /groups/{group-id}/drive/items/{item-id}/permissions/{perm-id}
GET /me/drive/items/{item-id}/permissions/{perm-id}
GET /sites/{site-id}/drive/items/{item-id}/permissions/{perm-id}
GET /users/{user-id}/drive/items/{item-id}/permissions/{perm-id}
Optional query parameters
This method support the $select query parameter to shape the response.
Response
If successful, this method returns a 200 OK
response code and Permission resource in the response body.
Example
Request
Here is an example of the request to access a permission on a folder.
GET /me/drive/items/{item-id}/permissions/{perm-id}
Response
If successful, this method returns a Permission resource for the specified ID.
HTTP/1.1 200 OK
Content-type: application/json
{
"grantedTo": {
"user": {
"displayName": "Ryan Gregg",
"id": "efee1b77-fb3b-4f65-99d6-274c11914d12"
}
},
"id": "1",
"roles": [ "write" ]
}
Remarks
The Permission resource uses facets to provide information about the kind of permission represented by the resource.
Permissions with a link facet represent sharing links created on the item. Sharing links contain a unique token that provides access to the item for anyone with the link.
Permissions with a invitation facet represent permissions added by inviting specific users or groups to have access to the file.
Error responses
Read the Error Responses topic for more information about how errors are returned.