Checking which users and groups has access to file or folder
-
20-02-2021 - |
题
Im trying to write rest to understand which users has access to a certain files and folder. What REST calls can I use to get which users has access to a file or folder?
解决方案
For a file you could try the below endpoint:
/_api/web/getFileByServerRelativeUrl('/Shared Documents/Document.docx')/ListItemAllFields/RoleAssignments?$expand=Member,Member/Users,RoleDefinitionBindings
For a folder :
/_api/web/getFolderByServerRelativeUrl('/Shared Documents/Folder1')/ListItemAllFields/RoleAssignments?$expand=Member,Member/Users,RoleDefinitionBindings
其他提示
Use below REST endpoint to get the users who has access to files with their permissions:
<siteUrl>/_api/web/getFolderByServerRelativeUrl('Shared Documents/General')?$expand=ListItemAllFields/RoleAssignments/Member,ListItemAllFields/RoleAssignments/RoleDefinitionBindings,ListItemAllFields/RoleAssignments/Member/Users
Reference: How to get permission levels for Files/Folders/Documents in Sharepoint using rest endpoints?