1

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.

8
  • Are you getting all the users from that group using the URL you mentioned in question? Oct 30, 2018 at 9:08
  • @TARUN Have you added the Domain group into SharePoint group? Oct 30, 2018 at 9:18
  • @SohailShaikh No it was not added into the SharePoint Group
    – TARUN
    Oct 30, 2018 at 9:32
  • @TARUN Are you able to get all users from that group using the REST Url mentioned? Oct 30, 2018 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, 2018 at 9:36

1 Answer 1

2

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.

1
  • 1
    that's a very smart workaround, @Sohail! Aug 16, 2019 at 23:27

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.