is there any way that in active directory is can pull out
my email addresses? I need a list of all my email
address.
Hi Brian,
just a couple of days ago I provided someone in one of the german groups with a
sample script to get the emails from Active Directory dynamicaly via a ASP-
Script on a WebServer (you can make great stuff with a dynamic Adressbook on a
WebServer, like being able to browse the company structure or departments,
depending how much effort you make writing it). I'll translate and paste the
simple sample below.
If you don't want it on a webserver or being dynamically you can also program
the same thing in VBS (look at the asp-script - since it's VBScript in there
it'll give you the idea), or you can use commandline tools like ldifde, csvde
(comma-separated for excel) or if you have a windows server 2003 you can use
dsquery or dsuser.
However, here's the asp (you'll have to set the variable strDomainDN to your
Domainname):
=== cut and paste this into a asp-file on a iis ===
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Adressbook</TITLE>
</HEAD>
<BODY>
<H1>E-Mail Adresses</H1>
<TABLE BORDER="1">
<%
strDomainDN = "dc=nwtraders,dc=msft"
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" )
objRS.MoveFirst
response.write "<tr bgcolor=""#aaaaaa""><td><B>" & objRS.Fields(0).Name & "</B>
</td>"
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>"
objRS.MoveNext
Wend
set objRS = nothing
set objCon = nothing
%>
</TABLE>
</BODY>
</HTML>
=== ende of File ===
Gruesse - Sincerely,
Ulf B. Simon-Weidner