Building Active Directory Paths
Building Active Directory Paths
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.
You can programmatically build Microsoft® Active Directory® paths by using CDO for Exchange Management (CDOEXM) Component Object Model (COM) classes. The following example shows how you can use each CDOEXM object to enumerate storage groups, public and mailbox stores in the storage groups, and the folder trees in which the stores appear.
Visual Basic
Private Sub EnumerateStore() Dim iExs As New CDOEXM.ExchangeServer Dim isg As New CDOEXM.StorageGroup Dim ipsDB As New CDOEXM.PublicStoreDB Dim imbxDB As New CDOEXM.MailboxStoreDB Dim ift As New CDOEXM.FolderTree Dim ds2 As IDataSource2 Set ds2 = iExs Debug.Print Chr(13) + Chr(13) + Chr(13) + "=================================" Dim server_nm As String server_nm = Environ("COMPUTERNAME") 'The computer name is the servername. ds2.Open server_nm Debug.Print "ExchangeVersion = " + iExs.ExchangeVersion Debug.Print "DirectoryServer = " + iExs.DirectoryServer Dim storegroup As Variant Dim pubstore As Variant Dim mbx As Variant For Each storegroup In iExs.StorageGroups Debug.Print "StorageGroup Distinguished Name = " + storegroup + Chr(13) isg.DataSource.Open storegroup For Each pubstore In isg.PublicStoreDBs Debug.Print "Public Store = " + pubstore ipsDB.DataSource.Open pubstore Debug.Print " Name = " + ipsDB.Name + Chr(13) Debug.Print "FolderTree = " + ipsDB.FolderTree ift.DataSource.Open ipsDB.FolderTree Debug.Print " RootFolderURL = " + ift.RootFolderURL Debug.Print " Name = " + ift.Name + Chr(13) Next 'public store For Each mbx In isg.MailboxStoreDBs Debug.Print "Mailbox = " + mbx imbxDB.DataSource.Open mbx Debug.Print " Name = " + imbxDB.Name + Chr(13) Next 'mailbox Next 'storage group Set iExs = Nothing Set isg = Nothing Set ipsDB = Nothing Set imbxDB = Nothing Set ift = 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.