You will have better performance querying the attribute area (ASQ). Here is a sample code:
DirectoryEntry group = new DirectoryEntry("LDAP://CN=All Staff,OU=Groups,DC=domain,DC=local");
DirectorySearcher searcher = new DirectorySearcher();
searcher.SearchRoot = group;
searcher.Filter =
"(&(objectClass=user)(objectCategory=person)(mail=*))";
searcher.PropertiesToLoad.Add("mail");
searcher.SearchScope = SearchScope.Base;
searcher.AttributeScopeQuery = "member";
List<string> mail;
using (SearchResultCollection results = searcher.FindAll())
{
mail = new List<string>();
foreach (SearchResult result in results)
{
mail.Add(result.Properties["mail"][0].ToString());
}
}
, System.DirectoryServices.AccountManagement , System.DirectoryServices. 99% . , LDAP .
, 1000 . , , , , .