Active Directory problem
I want to list all the users in the group "Group CFS Handlers", and extract "sAMAccountName" etc. for each user. How can I extract this info?When I run my code below search.FindAll() returns 0 results. I just checked the AD and the group "Group CFS Handlers" contain one user. My code look like this:
*****************************************************************
DirectoryEntry searchRoot = new DirectoryEntry(@"LDAP://company.root");
DirectorySearcher search = new DirectorySearcher(searchRoot);
search.Filter = "(&(cn=Group CFS Handlers)(objectCategory=user))";
search.PropertiesToLoad.Add("samaccountname");
foreach (SearchResult res in search.FindAll())
{
string dummy = res.Properties["samaccountname"].ToString();
}
****************************************************************
I you have any idea what I do wrong, please let my know.
