Platform SDK: Active Directory, ADSI, and Directory Services

Finding the Home Server of a Mailbox

The distinguished name of the home information store for the mailbox is located in the Home-MDB attribute.

Dim objMailbox As IADs
Dim objStore As IADs
 
Set objMailbox = _
        GetObject("LDAP://Server/cn=Mailbox,cn=Recipients,ou=Site,o=Org")
 
objMailbox.GetInfoEx Array("Home-MDB"), 0
Debug.Print objMailbox.Get("Home-MDB")
 
'This distinguished name can be parsed out to obtain the server name.
' Or you can bind to the Home-MDB Path and get the parent object
StorePath = objMailbox.Get("Home-MDB")
Set objStore = GetObject("LDAP://Server/" & StorePath)
Debug.Print objStore.Parent
 
Set objMailbox = Nothing
Set objStore = Nothing

Notes:  Changing the Home-MDB attribute does not move the mailbox. It only breaks the association between the attribute and the mailbox. It is not possible to move a mailbox programmatically using ADSI at this time.

This example is specific to Exchange Server version 5.5 and below, and is not upwardly compatible with Exchange 6.0. Management and access of Exchange 6.0 Servers should be made through the CDO Exchange Management interfaces instead.