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.

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

  • 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. – Robert Wagenaar Mar 29 '17 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. – Venkat Konjeti Mar 29 '17 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

  • 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. – Robert Wagenaar Mar 27 '17 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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