A Intranet Phonebook

I was asked frequently how to realize an Intranet-Phonebook which displays data dynamically out of the Active Directory.

Here's a short expample of a ASP-Site. Modify that script for your needs. Advantage of using ASP is that the user won't see the code but only the results.

Warning:The following Script is just a example, does not contain any error handling and needs to be adjusted and tested for your needs.

Script ASPPhonebook.asp

<meta HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">

<H1>E-Mail Adressen</H1>
strDomainDN = "dc=youdomain, dc=com"

Set objCon = CreateObject("ADODB.Connection")
objCon.Provider = "ADsDSOObject;"
objCon.Open "Active Directory Provider"
Set objRS = objCon.Execute("<LDAP://" & strDomainDN & ">;" & _
  "(&(objectCategory=Person)(objectClass=user)(mail=*));" & _
  "givenname,sn,mail;subtree" )
Response.write "<tr bgcolor=""#aaaaaa""><td><B>" & objRS.Fields(0).Name & "</B>
Response.write "<td><B>" & objRS.Fields(1).Name & "</B></td>"
response.write "<td><B>" & objRS.Fields(2).Name & "</B></td></tr>"
While Not objRS.EOF
  response.write "<tr><td>" & objRS.Fields(0).Value & "</td>"
  response.write "<td>" & objRS.Fields(1).Value & "</td>"
  response.write "<td><A HREF=""mailto:" & objRS.Fields(2).Value & """>"
  response.write objRS.Fields(2).Value & "</A></td></tr>" 
Set objRS = Nothing
Set objCon = Nothing


You are welcome to E-Mail comments, feedback or general Problems with this WebSite to the  WebMaster. The WebSites of WindowsServerFAQ.de and/or WindowsServerFAQ.org are not related to Microsoft Corp. USA or to Microsoft GmbH. Copyright 2004. ALL RIGHTS RESERVED. You have to accept the Disclaimer and the legal Annotations to use the WebSites of WindowsServerFAQ.de or WindowsServerFAQ.org.