<% @Import Namespace="System.DirectoryServices" %> <% DirectoryEntry de = new DirectoryEntry("LDAP://DC=DOMAIN,DC=COM","useraccount","password"); DirectorySearcher src = new DirectorySearcher("(&(objectCategory=Person)(objectClass=user))"); src.SearchRoot = de; src.SearchScope = SearchScope.Subtree; src.Sort.PropertyName = "Name"; Response.Write(""); Response.Write(""); Response.Write(""); foreach(SearchResult res in src.FindAll()) { if (res.Properties["physicalDeliveryOfficeName"] != null) { if (res.Properties["Name"] != null) { Response.Write(""); } else { Response.Write(""); } if (res.Properties["telephonenumber"] != null) { Response.Write(""); } else { Response.Write(""); } if (res.Properties["mobile"] != null) { Response.Write(""); } else { Response.Write(""); } if (res.Properties["homePhone"] != null) { Response.Write(""); } else { Response.Write(""); } if (res.Properties["otherTelephone"] != null) { Response.Write(""); } else { Response.Write(""); } } } Response.Write("
User Directory
NamePrimary NumberMobileHome OfficeExtension
" + res.Properties["Name"][0] + " " + res.Properties["telephonenumber"][0] + " " + res.Properties["mobile"][0] + " " + res.Properties["homePhone"][0] + " " + res.Properties["otherTelephone"][0] + "
 
"); %>