using System;
using System.Net;
using System.DirectoryServices;
public class MainClass {
public static void Main() {
using (DirectoryEntry de = new DirectoryEntry("LDAP://yourV/OU=yourV, DC=explorer, DC=local"))
using (DirectorySearcher searcher = new DirectorySearcher()) {
de.Username = @"explorer\yourName";
de.Password = "password";
searcher.SearchRoot = de;
searcher.Filter = "(&(objectClass=user)(description=Auth*))";
searcher.SearchScope = System.DirectoryServices.SearchScope.Subtree;
searcher.PropertiesToLoad.Add("name");
searcher.PropertiesToLoad.Add("description");
searcher.PropertiesToLoad.Add("givenName");
searcher.PropertiesToLoad.Add("wWWHomePage");
searcher.Sort = new SortOption("givenName", SortDirection.Ascending);
SearchResultCollection results = searcher.FindAll();
foreach (SearchResult result in results) {
ResultPropertyCollection props = result.Properties;
foreach (string propName in props.PropertyNames) {
Console.Write(propName + ": ");
Console.WriteLine(props[propName][0]);
}
}
}
}
}