Fetching the list of users who have permission to use SharePoint page
-
08-02-2021 - |
Domanda
When using _api/web/siteusers?
I get a lot of usernames and email adresses.
With XPath I managed to filter them.
Then I realized that there were a huge amount of usernames and email adresses who don't have access to my page.
In SharePoint theREST API /_api/web/siteusers
endpoint only provides the list of users has permission on current web.
How can I fetch the users who have the permission to use my Sharepoint page?
Soluzione
In case of you need to see permissions on the web you can simply
- Navigate to the web permissions page (
http://XXX/_layouts/15/user.aspx
)
In case of you need to see permissions to particular site page try the following
- Open site pages library
- Select page
- Click on
Shared with
-Advanced
Altri suggerimenti
to get permissions on SharePoint page by SP rest Api You may use the fallowing request:
.../_api/web/GetFileByServerRelativeUrl('[RELATIVE URL OF PAGE]')?$expand=ListItemAllFields/RoleAssignments/Member,ListItemAllFields/RoleAssignments/RoleDefinitionBindings,ListItemAllFields/RoleAssignments/Member/Users
where the relative url of the page would of a page like: https://SomeSharepoint.sharepoint.com/sites/test2/SitePages/test1.aspx will be /sites/test2/SitePages/test1.aspx and the request would look like
https://SomeSharepoint.sharepoint.com/sites/test2/_api/web/GetFileByServerRelativeUrl('/sites/test2/SitePages/test1.aspx')?$expand=ListItemAllFields/RoleAssignments/Member,ListItemAllFields/RoleAssignments/RoleDefinitionBindings,ListItemAllFields/RoleAssignments/Member/Users
Hope it helps