LDAP Query for Exchange 2000 
Author Message
 LDAP Query for Exchange 2000

Can anyone give me a hand..  I have some code which extracts a list of
Exchange 2k mailboxes on our system.  The problem is, the code will return
"custom receipients" for which mailboxes don't really exist.  Is there a way
to modify my code to return only valid user mailboxes??  No custom recips,
or public folders...

Here's a snipit of my code:

DomainName = "xyz.com"
GALDN = "CN=Default Global Address List,CN=All Global Address
Lists,CN=Address Lists Container,CN=RFBD,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=xyz,DC=com"

Set oRoot = GetObject("LDAP://" & DomainName & "/rootDSE")
strDefaultNamingContext = oRoot.get("defaultNamingContext")

Set objGAL = GetObject("LDAP://" & DomainName & "/" & GALDN)
GALQueryFilter = objGAL.get("purportedSearch")

strQuery = "<LDAP://" & DomainName & "/" & strDefaultNamingContext & ">;" &
GALQueryFilter &
";distinguishedName,displayName,mailNickname,msExchHideFromAddressLists;subt
ree"

Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADsDSOOBJECT"
oConn.Open "ADs Provider"

Set oComm = CreateObject("ADODB.Command")
oComm.ActiveConnection = oConn
oComm.Properties("Page Size") = 1000
oComm.CommandText = strQuery

Set rs = oComm.Execute

While Not rs.EOF
 WScript.Echo rs.Fields("mailNickname")
 rs.MoveNext
Wend

Any suggestions would be appreciated.

Thanks,
Troy



Mon, 10 Oct 2005 22:46:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. LDAP access to Exchange 5.5 over Windows 2000

2. Trying to query Exchange 5.5 LDAP provider using VBScript

3. Creating Exchange Mailbox with Win2000 & Exchange 2000

4. Content filter for Exchange 2000/SMTP 2000

5. Outlook 2000 exchange 2000 workflow

6. Global Journal in Outlook 2000/Exchange 2000

7. VB Sample to create Exchange Mailboxes over LDAP

8. LDAP protocol in exchange server 5.0

9. Using VB to access Exchange Server via ADSI/LDAP

10. LDAP and Exchange

11. Using VB to access Exchange Server via ADSI/LDAP

12. CDO / Exchange 2000

 

 
Powered by phpBB® Forum Software