Platform SDK: Exchange 2000 Server

Using the Interfaces In Context

[This is preliminary documentation and subject to change.]

The CDOEXM interfaces are aggregated into existing CDO and ADSI objects because they are used in relation to those objects. Similarly in ADSI, a Contact, Group or User interface may be obtained. Recipient management is implemented using properties on the object. While these properties are not always exposed on the IMailboxStore and IMailRecipient interfaces, they may be used within IMailRecipient methods.

See Accessing Mailboxes and Folders for important notes on accessing recipient mailboxes and folders using ADSI or using ExOLEDB.

The following example demonstrates the coordinated use of the CDO.Person interface (and its underlying object) with the IMailRecipient interface to create a mailbox enabled recipient.

[Visual Basic]
Sub CDOCreateMailBoxRecipient(ServerName As String, _
                              DomainName As String, _
                              emailname As String, _
                              FirstName As String, _
                              LastName As String)
                                        
'ServerName is something like "MyServer6"
'DomainName is something like "DC=MYDOMAIN3,DC=microsoft,DC=com"
'emailname is something like "jamessmith"

'this assumes the MDB to be "Private MDB"


Dim objPerson As New CDO.Person
Dim objMailbox As CDOEXM.IMailboxStore

objPerson.FirstName = FirstName
objPerson.LastName = LastName
objPerson.Fields("userPrincipalName") = LastName
objPerson.Fields("userAccountControl") = 512
objPerson.Fields("userPassword") = "password"
objPerson.Fields.Update
objPerson.DataSource.SaveTo "LDAP://" + ServerName + _
                            "/CN=" + emailname + _
                            ",CN=users," + DomainName


Set objMailbox = objPerson
objMailbox.CreateMailbox "LDAP://" + ServerName + _
                         "/CN=Private MDB" + _
                         ",CN=First Storage Group,CN=InformationStore,CN=" + _
                         ServerName + _
                         ",CN=Servers,CN=First Administrative Group," + _
                         "CN=Administrative Groups,CN=First Organization," + _
                         "CN=Microsoft Exchange,CN=Services," + _
                         "CN=Configuration," + DomainName

objPerson.DataSource.Save

End Sub