Here is the code to list Users from specific Active Directory (AD) Group.
- var context = new PrincipalContext(ContextType.Domain, "domain");
- var groupPrincipal = GroupPrincipal.FindByIdentity(context, "ADGroupName");
- if (groupPrincipal != null)
- {
- var listOfUsers = groupPrincipal.GetMembers(true);
- }
Happy Coding..