Exchange Manager - AddExchangeMailDomain

Version: 7C

HC7 Build: 7.00.0012 and later

API Build: 1.00.0001 and later

 

Exchange Manager - AddExchangeMailDomain adds an exchange mail domain under a specified website. This web service call can be made as http://your-domain.com/HC7API/ExchangeManager.asmx?op=AddExchangeMailDomain.

 

Input Parameters

 

 

 

Note : MailboxDatabaseName can be retrieved using GetMailboxDatabases

 

 

 

 

Output Parameters

 

N/A

 

Sample Optional Parameters

 

<Parameters>

<Parameter Name = "MailServerName">abc</Parameter>

<Parameter Name = "DefaultMailbox">john</Parameter>

<Parameter Name = "Language">French</Parameter>

</Parameters>

 

Sample SOAP Request

 

 

POST /HC7API/ExchangeManager.asmx HTTP/1.1

Host: your-domain.com

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: "http://tempuri.org/AddExchangeMailDomain"

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <AddExchangeMailDomain xmlns="http://tempuri.org/">

      <HostUserName>host</HostUserName>

      <HostPassword>host123</HostPassword>

      <OwnerName>david</OwnerName>

      <MailDomainName>MyMailDomain.com</MailDomainName>

      <MailDomainPassword>123</MailDomainPassword>

      <WebsiteName>MyDomain.com</WebsiteName>

      <MailboxDatabaseName>ENTERPRISEEX02\First Storage Group\ Mailbox Database</MailboxDatabaseName>

      <OptionalParam>xml</OptionalParam>

    </AddExchangeMailDomain>

  </soap:Body>

</soap:Envelope>

 

 

Sample HTTP Request

 

 

POST /HC7API/ExchangeManager.asmx/AddExchangeMailDomain HTTP/1.1

Host: your-domain.com

Content-Type: application/x-www-form-urlencoded

Content-Length: length

HostUserName=host&HostPassword=host123&OwnerName=david&MailDomainName=MyMailDomain.com&
MailDomainPassword=123&WebsiteName=MyDomain.com&OptionalParam=xml

 

 

Sample C# Code

 

 

public ExchangeManager.Response AddExchangeMailDomain(string strHostUserName, string strHostPassword, string strOwnerName, string strWebsiteName, string strMailDomainName, string strMailDomainPassword, string)

{

         try

         {

                    ExchangeManager.ExchangeManager oExchange = new ExchangeManager.ExchangerManager();

                    ExchangeManager.Response oResponse = new ExchangeManager.Response();

                    

  XmlDocument oDoc = new XmlDocument();

  //Adding root node

  XmlNode xOptionalParam = oDoc.CreateNode(XmlNodeType.Element,"Parameters","");

  //Adding sub nodes

  XmlNode xParameter = oDoc.CreateNode(XmlNodeType.Element,"Parameter","");

  XmlAttribute xAttribute = oDoc.CreateAttribute("Name");

  xAttribute.Value = "DefaultMailbox";

  xParameter.Attributes.Append(xAttribute);

  xParameter.InnerText = "xyz";

  xOptionalParam.AppendChild(xParameter);

  .......

  .......

  .......

                    oResponse = oExchange.AddExchangeMailDomain(strHostUserName, strHostPassword, strOwnerName,

                    strMailDomainName, strMailDomainPassword, strWebsiteName, OptionalParam);

                    

         }

         catch

         {

         }

         return oResponse;

}

 

 

Sample Response

 

 

<Response>

    <Method>AddMailDomain</ Method>

    <Status>true</Status>

    <ErrorCode>72300011</ErrorCode>

    <ErrorDescription>Mail Domain added successfully.</ErrorDescription>

    <Result/>

</Response>