Share via


Hosted Exchange::CreateMailbox

This procedure creates an Exchange mailbox for a specified user. Both CreateConsumerUser and CreateBusinessUser call this procedure if a mailbox plan is provided with input.

Arguments

Input Arguments Required Description

<path>

Yes

LDAP path of the organization.

<planName>

Yes

A valid Exchange mailbox service plan name.

<preferredDomainController>

Yes

<customerTypeName>

No

Determines the type of resource management to use. BusinessUser and ConsumerUser are the two allowed inputs for this parameter. If not provided the procedure defaults to BusinessUser resource management.

<mailStore/@algorithm>

No

Possible values are "level" and "tightPack". Default is "tightPack". If this attribute is "tightPack", allocations are packed tightly to minimize the number of servers used. Otherwise, packing is leveled across mail stores. Leveling is recommended to facilitate upselling of services. Note that this attribute is ignored if the customerTypeName=ConsumerUser.

<mailStore>/<serverName>

No

The name of a server to allocate a user's mailbox to. If this optional parameter is present then <mailStoreName> must also be present. If customerTypeName is BusinessUser the user's organization must already own storage space on the specified mailstore. If customerTypeName is ConsumerUser the mail store must be defined as a consumer mail store in Resource Manager.

<mailStore>/<mailStoreName>

No

The name of a mailstore to allocate a user's mailbox to. If this optional parameter is present then <serverName> must also be present. If customerTypeName is BusinessUser the user's organization must already own storage space on the specified mailstore. If customerTypeName is ConsumerUser the mail store must be defined as a consumer mail store in Resource Manager.

<proxyAddresses>

No

Additional proxy addresses for the user.

<alias>

No

The procedure will accept this as an optional parameter. Otherwise an alias will be generated from the UPN prefix (e.g. user from user@litwareinc.com).

<SMTPDomain>

No

The SMTP domain to use when generating the user's primary E-Mail address. If not provided, the primary SMTPDomain stored in the Customer Plan Database is used. In general this parameter should only be used for special cases where the default behavior needs to be overridden.

Remarks

Method Syntax

public string CreateMailbox( 
string ldapPath,  
string planName,  
string preferredDomainController, 
string customerTypeName, 
string mailStoresXmlString, 
string proxyAddressesXmlString, 
string alias, 
string smtpDomain, 
bool sendCredentials) 
        

Sample Code

Example XML Response

MPS XML Response in string format. Shown for format only; content may vary.

<response> 
  <data> 
   <path>LDAP://CN=user@alpineskihouse.com,ou=alpineskihouse,OU=Wh,OU=Hosting,DC=fabrikam,DC=Com</path> 
    <planName>BaseMail</planName> 
    <preferredDomainController>AD01.fabrikam.com</preferredDomainController> 
    <properties> 
      <property name="msExchQueryBaseDN">OU=alpineskihouse,OU=WH,OU=Hosting,DC=fabrikam,DC=com</property> 
      <property name="mail">user@alpineskihouse.com</property> 
      <property name="msExchMailboxFolderSet"> 
        <value>98821</value> 
      </property> 
      <property name="showInAddressBook" 
          mode="append"> 
 
        <value>CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=fabrikam,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=fabrikam,DC=com</value> 
      </property> 
      <property name="msExchUserAccountControl">0</property> 
    </properties> 
    <mdb>BusinessMailstore1</mdb> 
    <server>EXBE02</server> 
    <path>LDAP://AD01.fabrikam.COM/CN=user@alpineskihouse.com,ou=alpineskihouse,OU=Wh,OU=Hosting,DC=fabrikam,DC=Com</path> 
    <alias>user</alias> 
    <queryBase>OU=alpineskihouse,OU=WH,OU=Hosting,DC=fabrikam,DC=com</queryBase> 
    <proxyAddresses> 
      <value>user@alpineskihouse.com</value> 
    </proxyAddresses> 
    <mail> 
      <disableIMAP>0</disableIMAP> 
      <disablePOP>0</disablePOP> 
      <disableHTTP>0</disableHTTP> 
      <size>10000</size> 
    </mail> 
  </data> 
</response> 
                

Typical C# Usage

//Get user name and password.                    
        string userName = this.Request.ServerVariables.Get("AUTH_USER"); 
        string pass = this.Request.ServerVariables.Get("AUTH_PASSWORD"); 
        //Set credentials. 
        hostedExch.PreAuthenticate = true; 
        hostedExch.Credentials = new NetworkCredential(userName,pass); 
 
        lblMsg.InnerHtml = mpsResponseHeaderLabel; 
        //Display response. 
        this.mpsResponse.DocumentSource = ""; 
        response = hostedExch.CreateMailbox(ldapPath, planName, preferredDomainController, customerTypeName, mailStoresXmlString, proxyAddressesXmlString, alias, smtpDomain, sendCredentials);                  
         
// set the response XML to match the return from MPF 
        responseXml.LoadXml(response); 
        this.mpsResponse.Document = responseXml; 
lblDone.InnerText = successMsg; 
        

Applies To

Hosted Exchange Web Service for:

  • Hosted Messaging and Collaboration version 3.5

  • Hosted Messaging and Collaboration version 3.0

See also

Tasks

Hosted Exchange::CreateMailboxPlan
Hosted Exchange::ChangeUserMailboxPlan