0

We have a SharePoint 2013 On premise environments and having the Domain Groups with the Names contains SPECIAL characters as (Role)x$Customer$2838.

Using the below rest call i am able to get all the Groups.

"/_api/web/siteusers?$select=id,Title&$filter=PrincipalType eq 4";

Now i want to Check the Current login user exists in a specific Domain Group using Rest api.

  • Are you getting all the users from that group using the URL you mentioned in question? – Ganesh Sanap Oct 30 '18 at 9:08
  • @TARUN Have you added the Domain group into SharePoint group? – Sohail Shaikh Oct 30 '18 at 9:18
  • @SohailShaikh No it was not added into the SharePoint Group – TARUN Oct 30 '18 at 9:32
  • @TARUN Are you able to get all users from that group using the REST Url mentioned? – Sohail Shaikh Oct 30 '18 at 9:34
  • @SohailShaikh with the above URL I am able to get all the AD groups List available in the site – TARUN Oct 30 '18 at 9:36
0

First add the AD group into a SharePoint group. You can set the group setting "Who can view the membership of the group" in SP-Group-Settings to "Group Members". Then only members of the group can see the members of that group. Luckily you can ask if the current-user has the right to view a groups membership. So if the user can view the membership of the group then he/she must be a member

Use below REST Url:

http://<siteurl>/_api/web/sitegroups/getbyname('SharePointGroupName')/CanCurrentUserViewMembership

The above REST will return a boolean value depending on whether user is part of the AD group or not.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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