Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Finding Exchange Address Lists with ADSI
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Visual Basic
' Finding Exchange Address Lists with ADSI
' This sample demonstrates how to find Exchange address lists by searching
' Microsoft Active Directory.
' Add a reference to Microsoft ActiveX Data Objects 2.5 Library.
' Add a reference to Active DS Type Library.
Sub AddressList()
' Find the Exchange address lists by searching Active Directory.
' This can be run from any DSClient-enabled computer.
Dim iAdRootDSE As IADs
Dim Conn As New ADODB.Connection
Dim Com As New ADODB.Command
Dim Rs As ADODB.Recordset
Dim varConfigNC As Variant
Dim strQuery As String
' Get the configuration naming context.
Set iAdRootDSE = GetObject("LDAP://RootDSE")
varConfigNC = iAdRootDSE.Get("configurationNamingContext")
' Open the connection.
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
' Build the query to find all of the address lists.
strQuery = "<LDAP://" & varConfigNC & ">;(objectCategory=addressBookContainer);name,purportedSearch;subtree"
Com.ActiveConnection = Conn
Com.CommandText = strQuery
Set Rs = Com.Execute
' Iterate through the results.
While Not Rs.EOF
' Print the name of the address list and the query that is used to build it.
Debug.Print "Name: " & Rs.Fields("name") & vbLf & "Query: " & Rs.Fields("purportedSearch")
Rs.MoveNext
Wend
' Clean up.
Rs.Close
Conn.Close
Set Rs = Nothing
Set Com = Nothing
Set Conn = Nothing
End Sub
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.