Reputation: 6529
The question basically says it all. I want to be able to get a list of all the users on the windows domain (i.e. in the active directory) using c#.
Thanks!
Upvotes: 5
Views: 755
Reputation: 5474
var dirEntry = new DirectoryEntry(string.Format("LDAP://{0}/{1}", "x.y.com", "DC=x,DC=y,DC=com"));
var searcher = new DirectorySearcher(dirEntry)
{
Filter = "(&(&(objectClass=user)(objectClass=person)))"
};
var resultCollection = searcher.FindAll();
SEE: Get all users from AD domain
Upvotes: 5