Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
The following example creates a new recipient and an accompanying mailbox. The IMailboxStore interface is aggregated onto the Person object. This allows the person information to be used when creating the mailbox.
Create a mailbox for a mail recipient.
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