User-2057865890 posted
Hi Krisrajz,
We are using System.DirectoryServices namespace to perform a search on
AD.
The System.DirectoryServices.AccountManagement namespace provides uniform access
and manipulation of user, computer, and group security principals.
using 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;
}
reference: http://stackoverflow.com/a/5310317
Best Regards,
Chris