Code to find out all users in the given Domain
This code uses the LDAP.It first creates a directoryentry to the domain and searches for the users available there.
The search patter is given as (objectClass=User)
You can modify this as * if you need all the objects in that domain.
DirectoryEntry entryToSearch = new DirectoryEntry("LDAP://identitymine");
System.DirectoryServices.DirectorySearcher mySearcher = new System.DirectoryServices.DirectorySearcher(entryToSearch);
mySearcher.Filter = ("(objectClass=User)");
foreach (System.DirectoryServices.SearchResult resEnt in mySearcher.FindAll())
{
DirectoryEntry entry= resEnt.GetDirectoryEntry();
MessageBox.Show(entry.Name);
}
