Hello ,everyone:
I want to search domain user in active directory uses those code ,but
the result not return domain user information ,
but only return the domain computer ,how can I resolve the problem!
System.DirectoryServices.DirectoryEntry entry =
new
System.DirectoryServices.DirectoryEntry("LDAP://silan.com/DC=silan,DC=com");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("(anr=chen)");
string s = "";
foreach(System.DirectoryServices.SearchResult result in
mySearcher.FindAll())
{
s = result.GetDirectoryEntry().Path;
Console.WriteLine(s );
}
Shiva - 03 Aug 2004 12:26 GMT
Hi,
You might want to add (objectClass=user) to the filter condition and try.
Eg:
mySearcher.Filter = "(&(objectClass=user)(anr=chen))";
Hello ,everyone:
I want to search domain user in active directory uses those code ,but
the result not return domain user information ,
but only return the domain computer ,how can I resolve the problem!
System.DirectoryServices.DirectoryEntry entry =
new
System.DirectoryServices.DirectoryEntry("LDAP://silan.com/DC=silan,DC=com");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("(anr=chen)");
string s = "";
foreach(System.DirectoryServices.SearchResult result in
mySearcher.FindAll())
{
s = result.GetDirectoryEntry().Path;
Console.WriteLine(s );
}