Title: Message
I wrote the code below a while ago to do something similar, and should work for you.
http://www.wiredeuclid.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=2&page=1
 
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 addresses

I 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 = 0
 
For 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): " & i
 
Thanks
 

Reply via email to