Platform SDK: Exchange 2000 Server

IMailBoxStore Interface

[This is preliminary documentation and subject to change.]

This interface provides access to the administrative properties of a mailbox-enabled recipient. It also provides methods to create, move and delete mailboxes. See Managing Mail Recipients for overview information.

IID
25150F41-5734-11d2-A593-00C04F990D8A
Extends
IDispatch

Member Summary

Properties

Name Type Description
DaysBeforeGarbageCollection

[Visual Basic,VBScript] Long

[C++,IDL]Long

The number of days deleted mail is retained before it is permanently deleted.
Delegates

[Visual Basic,VBScript] String

[C++,IDL] BSTR

The list of URLs of all users that have access to the mailbox.
EnableStoreDefaults

[Visual Basic,VBScript] Boolean

[C++,IDL] VARIANT_BOOL

Dictates whether to use only default store values for storage limits, or to use other properties pertaining to the mailbox.
GarbageCollectOnlyAfterBackup

[Visual Basic,VBScript] Boolean

[C++,IDL] VARIANT_BOOL

Dictates whether deleted messages can only be permanently deleted after the mailbox has been backed up.
Hardlimit

[Visual Basic,VBScript] Long

[C++,IDL]Long

The mailboxes maximum size, in Kbytes, over which sending and receiving is restricted.
HomeMDB

[Visual Basic,VBScript] String

[C++,IDL] BSTR

The URL of the store for the recipient.
OverQuotaLimit

[Visual Basic,VBScript] Long

[C++,IDL]Long

The maximum size, in Kbytes, over the StoreQuota property size upon which sending mail is disabled.
OverrideStoreGarbageCollection

[Visual Basic,VBScript] Boolean

[C++,IDL] VARIANT_BOOL

Dictates whether the store should be prevented from permanently deleting deleted messages.
RecipientLimit

[Visual Basic,VBScript] Long

[C++,IDL]Long

Maximum number of people to which the recipient can send mail (per email).
StoreQuota

[Visual Basic,VBScript] Long

[C++,IDL]Long

The maximum size, in Kbytes, allowed for the mailbox.

Methods

Name Description
CreateMailBox Creates a mailbox at a specified URL.
DeleteMailBox Deletes a mailbox at a specified URL.
MoveMailBox Moves a mailbox to a specified URL.

Example (CDOEXM)

[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

Example (ADSI)

[Visual Basic]
Function ADSICreateMailBoxRecipient(ServerName As String, _
                                    DomainName As String, _
                                    emailname As String, _
                                    FirstName As String, _
                                    LastName As String) As Integer

'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 objUser As IADsUser
Dim objContainer As IADsContainer
Dim objMailbox As CDOEXM.IMailboxStore
Dim recipname As String, recip As String

recip = "CN=" & emailname

' get the container
Set objContainer = GetObject("LDAP://" + ServerName + "/" + _
                            "CN=users," + DomainName)

' create a recipient
Set objUser = objContainer.Create("User", recip)
objUser.Put "samAccountName", emailname
objUser.Put "sn", LastName
objUser.Put "givenName", FirstName
objUser.Put "userPrincipalName", emailname

objUser.SetInfo
objUser.SetPassword "password"  'let user change it later
objUser.AccountDisabled = False

Set objMailbox = objUser

'Create a mailbox for the recipient
'You cannot create a mailbox using ADSI, so use CDOEXM
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
objUser.SetInfo

End Function