Partager via


IMailBoxStore Interface

IMailBoxStore Interface

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. 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.

CLSID

25150F41-5734-11d2-A593-00C04F990D8A

Extends

IDispatch

Type Library

Microsoft CDO for Exchange Management Library

DLL Implemented In

CDOEXM.DLL

Member Summary

The following table lists the properties of the IMailBoxStore interface.

Name Description
DaysBeforeGarbageCollection The DaysBeforeGarbageCollection property specifies the number of days deleted mail is retained before it is permanently deleted.
Delegates The Delegates property specifies the list of URLs of all users that have access to the mailbox.
EnableStoreDefaults The EnableStoreDefaults property specifies whether to use only default store values for storage limits.
GarbageCollectOnlyAfterBackup The GarbageCollectOnlyAfterBackup property specifies whether deleted messages can only be permanently deleted after the mailbox has been backed up.
Hardlimit The Hardlimit property specifies the maximum mailbox size, in kilobytes (KB), over which sending and receiving mail is disabled.
HomeMDB The HomeMDB property specifies the URL of the mailbox store of the recipient. This property is read-only.
OverQuotaLimit The OverQuotaLimit property specifies a size limit, in KB, of a mailbox. If this limit is exceeded, sending mail is disabled.
OverrideStoreGarbageCollection The OverrideStoreGarbageCollection property indicates whether this mailbox should use the garbage collection properties set on this mailbox, or the properties set on the database.
RecipientLimit The RecipientLimit property specifies the maximum number of people to whom the recipient can send e-mail.
StoreQuota The StoreQuota property specifies the maximum size, in KB, allowed for the mailbox.

The following table lists the methods of the IMailBoxStore interface.

Name Description
CreateMailBox The CreateMailBox method creates a mailbox at a specified URL.
DeleteMailBox The DeleteMailBox method deletes a mailbox.
MoveMailBox The MoveMailBox method moves a mailbox to a specified URL.

Examples

[Microsoft® Visual Basic® :CDO for Exchange Management (CDOEXM)]

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

Set oPerson = New CDO.Person
' Bind
oPerson.DataSource.Open strURL

' Create Mailbox
Set oMailbox = oPerson
oMailbox.CreateMailbox strHomeMDBUrl

' Save
oPerson.DataSource.Save

'CleanUp
Set oPerson = Nothing
Set oMailbox = Nothing

End Sub

[Visual Basic: Active Directory® Service Interfaces (ADSI) ]

Sub ADSICreateMailBoxRecipient(DCServer As String, _
                                DomainName As String, _
                                emailname As String, _
                                FirstName As String, _
                                LastName As String)

'DCServer is something like "DCServer6" 'DomainName is something like "DC=MYDOMAIN3,DC=example,DC=com" 'emailname is something like "jamessmith"

'this assumes the MDB to be a mailbox store

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://" + DCServer + "/" + _ "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" 'user should change this later objUser.AccountDisabled = False

Set objMailbox = objUser

'Create a mailbox for the recipient 'You cannot create a mailbox using ADSI DCServer, so use CDOEXM 'The values below may differ in other organizations objMailbox.CreateMailbox "LDAP://" + DCServer + _ "/CN=Private MDB" + _ ",CN=First Storage Group,CN=InformationStore,CN=" + _ DCServer + _ ",CN=Servers,CN=First Administrative Group," + _ "CN=Administrative Groups,CN=First Organization," + _ "CN=Microsoft Exchange,CN=Services," + _ "CN=Configuration," + DomainName objUser.SetInfo

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.