% @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("| User Directory | ||||||||
| Name | Primary Number | Mobile | Home Office | Extension | ||||
| " + res.Properties["Name"][0] + " | "); } else { Response.Write(""); } if (res.Properties["telephonenumber"] != null) { Response.Write(" | " + res.Properties["telephonenumber"][0] + " | "); } else { Response.Write(""); } if (res.Properties["mobile"] != null) { Response.Write(" | " + res.Properties["mobile"][0] + " | "); } else { Response.Write(""); } if (res.Properties["homePhone"] != null) { Response.Write(" | " + res.Properties["homePhone"][0] + " | "); } else { Response.Write(""); } if (res.Properties["otherTelephone"] != null) { Response.Write(" | " + res.Properties["otherTelephone"][0] + " | "); } } } Response.Write(" |