0

I would like to use the SharePoint REST api to get an overview of all users of a SharePoint teamsite (=SharePoint web).

I know I can get a list of all the users of the site collection using the following command:

_api/web/siteusers/

Unfortunately that does not help me in retrieving the users for a specific web.

What I would like to receive is a list similar to the information that is shown using the 'Site Users webpart' (but with more detailed information about each user)

We are using SharePoint online.

2 Answers 2

1

The site users you can get it from the role assignment object. you can use following rest api call.

<<site url>> + /_api/Web/RoleAssignments

You can refer following msdn article for additional reference https://msdn.microsoft.com/en-us/library/office/dn531432.aspx#bk_RoleAssignment

2
  • this does indeed provide the information that I'm looking for,thanks! I've tried using an admin account, which works fine. For regular users I get a permission denied. But maybe there is a way to work around this, so that I can use it in javascript under the permissions of a regular user. Commented Mar 29, 2017 at 14:09
  • The query will run with user context. The user who has permissions to see the permissions can able to get results. You might need to look for elevated privileged option in order to run for every account. Commented Mar 29, 2017 at 16:46
1

If You want to display information of Users in site then

_spPageContextInfo.webAbsoluteUrl + "/_api/Web/SiteUserInfoList"

Here is link to refer

1
  • This also refers to the Users in the SiteCollection not the Web, if I'm ready this correctly. My question concerns the users in the Web, not the Sitecollection. Commented Mar 27, 2017 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.