I
wrote the code below a while ago to do something similar, and should work for
you.
Its
written for an Exchange 5.5 server, but the logic is pretty similar for AD/E2k
as well.
--------------------------------------------------------------
Roger D. Seielstad -
MTS MCSE MS-MVP
Sr. Systems Administrator
Inovis Inc.
-----Original Message-----
From: Michael B. Smith [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 3:51 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] Looking up all email addressesI need a piece of code that, given a user object, returns me an object or collection to all of the email addresses for that user. I can't find the object.Help!Set objContainer = GetObject("LDAP://CN=Users," + DomainName)objContainer.Filter = Array("User")
i = 0For Each objUser In objContainer
name = objUser.name
name = Right(name, Len(name) - 3)
Set objMailbox = objUser
<<---->>> code goes here!!!If objMailbox.HomeMDB = "" Then
Wscript.echo name + " (no mailbox)"
Else
Wscript.echo name + " (has mailbox)"
End If
i = i + 1
Next
Wscript.echo "Number of users found in the DS (in the default container): " & iThanks
