One of the fields on list is User Picker where often are place AD groups.

Authentication is set up with claims.

While presenting the item, users which are in this AD groups (and others mentioned in this field), need to see an button. Other (which have permission to see this item but were not mentioned) should not.

How can I get information, whether user is in this AD group?

  • Did you find any solution for this? Commented Feb 6, 2019 at 10:09

3 Answers 3


I use an extension method, like this:

 public static bool InGroup(this SPUser User, string GroupName)
        return User.Groups.Cast<SPGroup>().Any(g => g.Name.ToLower() == GroupName.ToLower());

Then call it like this:

bool inGroup = spuser.InGroup("GroupName");
  • This are not SPGroup, but AD Groups. Additional difficulty that they are claim based and SharePoint sees them as users.
    – Jacek
    Commented Aug 17, 2016 at 9:21
  • How can AD user come in claim based? Can you be more specific like you want to check this for the claim based users or for the AD users ? Because if your User is in AD group, you still will need to add him in any sharepoint group to give him access in sharepoint, untill and unless he don't have access. He will not be able to access SharePoint. Nd for the other case i.r claim based, the data for that is maintained in SQL database . So for which user you want to check ?
    – Muskan
    Commented Aug 17, 2016 at 9:25

You can get a flat transitive/recursive list of the user's AD security and O365 group memberships using this endpoint:


Steps to find User belongs to AD Group.

  • Create a SharePoint Group and add AD Group into SharePoint Group Use the below code to find user belongs to SharePoint Group or not

How to check if current user belongs to SharePoint group via CSOM (JavaScript):

function IsCurrentUserMemberOfGroup(groupName, OnComplete) {

    var currentContext = new SP.ClientContext.get_current();
    var currentWeb = currentContext.get_web();

    var currentUser = currentContext.get_web().get_currentUser();

    var allGroups = currentWeb.get_siteGroups();

    var group = allGroups.getByName(groupName);

    var groupUsers = group.get_users();


    function OnSuccess(sender, args) {
        var userInGroup = false;
        var groupUserEnumerator = groupUsers.getEnumerator();
        while (groupUserEnumerator.moveNext()) {
            var groupUser = groupUserEnumerator.get_current();
            if (groupUser.get_id() == currentUser.get_id()) {
                userInGroup = true;

    function OnFailure(sender, args) {



function IsCurrentUserHasContribPerms() 
  IsCurrentUserMemberOfGroup("Members", function (isCurrentUserInGroup) {
        // The current user is in the [Members] group!

ExecuteOrDelayUntilScriptLoaded(IsCurrentUserHasContribPerms, 'SP.js');

Check if user is in a specified group

  • AD groups are not handled by this Commented Jan 19, 2018 at 10:16
  • I didn't say this is only the way to find user belongs to AD group.. by using client context this would be the simplest way. Commented Jan 22, 2018 at 0:33
  • @NagarajuPattem this does not work with AD groups, it doesn't appear in the list of groups of the user.
    – netadictos
    Commented Oct 11, 2018 at 7:57
  • @netadictos If you follow all the above steps you can identify AD Groups which we implemented long back and let me know where you have the issue. Commented Nov 1, 2018 at 5:13
  • Nagaraju - can you provide any update for AD group scenario. Otherwise you can simply put the other link reference in comment Commented Feb 6, 2019 at 10:11

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.