Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

My requirement in one of my projects is like, I have 2 Active Directory Groups say Team Group and HR group and members(users) total of 25. So I have to differentiate those 25 users in under which group will go. This I have to do in SharePoint 2010. Can anyone get me out of this problem?

share|improve this question
    
It isn't clear what exactly you are trying to do. Are you trying to secure content? Can you elaborate? –  Kit Menke Dec 15 '11 at 17:37
    
actually how can we get the users list of a particular group... Actually in my project iam sending mail through workflow by sharepoint designer 2010..so if user inserts an item in custom list the mail has to go to his particular Managers group... –  Naresh Nemuri Dec 16 '11 at 4:20
    
If I understand correctly, you're trying to lookup the current user's manager and then get the Manager's distribution lists to send an email to? –  Kit Menke Dec 16 '11 at 14:41
    
yes,exactly..i wants to send email to manager's group.. –  Naresh Nemuri Dec 22 '11 at 5:07
add comment

2 Answers 2

It sounds like you want to use the user's domain username to see if that user is a member of a specific active directory group or not. This can be easily done using a C# function such as the one posted here by Nick (.net 3.5 referencing System.DirectoryServices.AccountManagement):

public List<string> GetGroupNames(string userName)
{
  var pc = new PrincipalContext(ContextType.Domain);
  var src = UserPrincipal.FindByIdentity(pc, userName).GetGroups(pc);
  var result = new List<string>();
  src.ToList().ForEach(sr => result.Add(sr.SamAccountName));
  return result;
}

You can then loop through all groups a user belongs to in order to determine if a user belongs to a specific group or not.

Pete

share|improve this answer
add comment

Active director security groups can be used in SharePoint groups. So you'd just want to add the specific AD security group to corresponding SharePoint groups. Then you can do any access and permissions you need from that point on to the SharePoint content.

share|improve this answer
    
Actually how can we get the users list of a particular group... Actually in my project iam sending mail through workflow by sharepoint designer 2010..so if user inserts an item in custom list the mail has to go to his particular Managers group... –  Naresh Nemuri Dec 16 '11 at 4:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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