Share via


Using the Interfaces in Context

Using the Interfaces in Context

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.

The CDO for Exchange Management (CDOEXM) recipient interfaces (IMailRecipient and IMailboxStore) are aggregated into existing Collaboration Data Objects (CDO) and Active Directory® Service Interfaces (ADSI) classes.

For important information about accessing recipient mailboxes and folders by using ADSI or Exchange OLE DB (ExOLEDB), see Accessing Mailboxes and Folders.

The following example demonstrates the coordinated use of the CDO.Person interface (and its underlying object) with the IMailboxStore interface to create a mailbox-enabled recipient. The example uses the CreateUserURL function, which is described in the topic Creating a User URL.

Visual Basic

Sub CreateMailboxCDOPerson(strFirstName As String, _
                                   strLastName As String, _
                                   strHomeMDBUrl As String)
'strHomeMDBUrl should look like this
'strHomeMDBUrl = "CN=Mailbox Store (MYSTORE),CN=First Storage Group,
'                 CN=InformationStore,CN=MYSTORE,CN=Servers,
'                 CN=First Administrative Group,CN=Administrative Groups,
'                 CN=IASI,CN=Microsoft Exchange,CN=Services,CN=Configuration,
'                 DC=mydomain,DC=fourthcoffee,DC=com"

    Dim oPerson         As New CDO.Person
    Dim oMailbox        As CDOEXM.IMailboxStore
    Dim strUserName     As String
    Dim strURL          As String
    Dim strContainerName As String

    strUserName = strFirstName & strLastName

    strContainerName = "Users"
    ' Create URL for the user
    CreateUserURL strURL, strContainerName, False, strUserName

    oPerson.FirstName = strFirstName
    oPerson.LastName = strLastName

    oPerson.DataSource.SaveTo strURL

    ' Create Mailbox
    Set oMailbox = oPerson
    oMailbox.CreateMailbox strHomeMDBUrl

    ' Save
    oPerson.DataSource.Save

    'CleanUp
    Set oPerson = Nothing
    Set oMailbox = 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.