Public structure which contains auto discover properties
Esempio n. 1
0
        /// <summary>
        /// Get auto discover properties for server name and proxy name
        /// </summary>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions,
        /// and adapters for test code onto its execution context.</param>
        /// <param name="server">Server to connect.</param>
        /// <param name="userName">User name used to logon.</param>
        /// <param name="domain">Domain name.</param>
        /// <param name="requestURL">The server url address to receive the request from clien.</param>
        /// <param name="transport">The current transport used in the test suite.</param>
        /// <param name="publicFolderUser">The name of public folder mailbox.</param>
        /// <returns>Returns the structure contains auto discover properties.</returns>
        public static AutoDiscoverProperties GetAutoDiscoverProperties(
            ITestSite site,
            string server,
            string userName,
            string domain,
            string requestURL,
            string transport,
            string publicFolderMailbox)
        {
            HttpStatusCode httpStatusCode = HttpStatusCode.Unused;
            XmlDocument    doc            = new XmlDocument();
            XmlNodeList    elemList       = null;
            string         requestXML     = string.Empty;
            string         responseXML    = string.Empty;

            AutoDiscoverProperties autoDiscoverProperties = new AutoDiscoverProperties
            {
                PrivateMailboxServer = null,
                PrivateMailboxProxy  = null,

                PublicMailboxServer = null,
                PublicMailboxProxy  = null,

                PublicMailStoreUrl  = null,
                PrivateMailStoreUrl = null,

                AddressBookUrl = null
            };

            // Get auto discover properties for private mailbox
            requestXML = "<Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006\">" +
                         "<Request><EMailAddress>" + userName + "@" + domain + "</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>";

            if (transport == "mapi_http")
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, true);
                site.Assert.AreEqual <HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);

                elemList = doc.GetElementsByTagName("MailStore");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "MailStore element should exist in response.");
                string mailStoreUrl = GetMAPIInternalURLProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(mailStoreUrl), "The mailstore internal URL should be gotten under MailStore element");
                autoDiscoverProperties.PrivateMailStoreUrl = mailStoreUrl; // Add private mailbox server

                elemList = doc.GetElementsByTagName("AddressBook");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "AddressBook element should exist in response.");
                string addressBookUri = GetMAPIInternalURLProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(addressBookUri), "The AddressBook internal URL should be gotten under AddressBook element");
                autoDiscoverProperties.AddressBookUrl = addressBookUri;
            }
            else
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, false);
                site.Assert.AreEqual <HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);

                elemList = doc.GetElementsByTagName("PublicFolderInformation");
                if (elemList == null || elemList.Count == 0)
                {
                    // Not found PublicFolderInformation means the SUT is not Microsoft Exchange Server 2013, in this case, proxy will not be changed and using original server name.
                    // For Microsoft Exchange Server 2010 the private mailbox server should be same as public folder server
                    autoDiscoverProperties.PrivateMailboxServer = server; // Add private mailbox server
                    autoDiscoverProperties.PublicMailboxServer  = server; // Add public mailbox server

                    return(autoDiscoverProperties);
                }

                // That the PublicFolderInformation is found means that the SUT is Microsoft Exchange Server 2013, in this case, get server name and proxy information for both private mailbox and public folder.
                elemList = doc.GetElementsByTagName("Protocol");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "Protocol element should exist in response.");

                string privateMailboxServer = GetServerNameProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(privateMailboxServer), "The private mailbox server name should be gotten under Protocol element");

                string privateMailboxProxy = GetServerProxyProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(privateMailboxProxy), "The private mailbox server proxy should be gotten under Protocol element");

                autoDiscoverProperties.PrivateMailboxServer = privateMailboxServer; // Add private mailbox server
                autoDiscoverProperties.PrivateMailboxProxy  = privateMailboxProxy;  // Add private mailbox proxy
            }

            // Get auto discover properties for public mailbox
            string smtpAddress = publicFolderMailbox + "@" + domain;

            requestXML = "<Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006\">" +
                         "<Request><EMailAddress>" + smtpAddress + "</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>";
            responseXML = string.Empty;

            if (transport == "mapi_http")
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, true);
                site.Assert.AreEqual <HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);

                elemList = doc.GetElementsByTagName("MailStore");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "MailStore element should exist in response.");

                string publicMailStoreUrl = GetMAPIInternalURLProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(publicMailStoreUrl), "The public folder mailbox server name should be gotten under MailStore element");

                autoDiscoverProperties.PublicMailStoreUrl = publicMailStoreUrl; // Add public mailbox server
            }
            else
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, false);
                site.Assert.AreEqual <HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);
                elemList = doc.GetElementsByTagName("Protocol");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "There should be an element called Protocol.");

                string publicMailboxServer = GetServerNameProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(publicMailboxServer), "The public folder mailbox server name should be gotten under Protocol element");

                string publicMailboxProxy = GetServerProxyProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(publicMailboxProxy), "The public folder mailbox server proxy should be gotten under Protocol element");

                autoDiscoverProperties.PublicMailboxServer = publicMailboxServer; // Add public mailbox server
                autoDiscoverProperties.PublicMailboxProxy  = publicMailboxProxy;  // Add public mailbox proxy
            }

            return(autoDiscoverProperties);
        }
Esempio n. 2
0
        /// <summary>
        /// Send ROP request to the server.
        /// </summary>
        /// <param name="requestROPs">ROP request objects.</param>
        /// <param name="requestSOHTable">ROP request server object handle table.</param>
        /// <param name="responseROPs">ROP response objects.</param>
        /// <param name="responseSOHTable">ROP response server object handle table.</param>
        /// <param name="rgbRopOut">The response payload bytes.</param>
        /// <param name="pcbOut">The maximum size of the rgbOut buffer to place Response in.</param>
        /// <param name="mailBoxUserName">Autodiscover find the mailbox according to this username.</param>
        /// <returns>0 indicates success, other values indicate failure. </returns>
        public uint RopCall(
            List <ISerializable> requestROPs,
            List <uint> requestSOHTable,
            ref List <IDeserializable> responseROPs,
            ref List <List <uint> > responseSOHTable,
            ref byte[] rgbRopOut,
            uint pcbOut,
            string mailBoxUserName = null)
        {
            // Log the rop requests
            if (requestROPs != null)
            {
                foreach (ISerializable requestROP in requestROPs)
                {
                    byte[] ropData = requestROP.Serialize();
                    this.site.Log.Add(LogEntryKind.Comment, "Request: {0}", requestROP.GetType().Name);
                    this.site.Log.Add(LogEntryKind.Comment, Common.FormatBinaryDate(ropData));
                }
            }

            // Construct request buffer
            byte[] rgbIn = this.BuildRequestBuffer(requestROPs, requestSOHTable);

            uint ret = 0;

            switch (this.MapiContext.TransportSequence.ToLower())
            {
            case "mapi_http":
                ret = this.mapiHttpAdapter.Execute(rgbIn, pcbOut, out rgbRopOut);
                break;

            case "ncacn_ip_tcp":
            case "ncacn_http":
                ret = this.rpcAdapter.RpcExt2(ref this.cxh, rgbIn, out rgbRopOut, ref pcbOut);
                break;

            default:
                this.site.Assert.Fail("TransportSeq \"{0}\" is not supported by the test suite.");
                break;
            }

            RPC_HEADER_EXT[] rpcHeaderExts;
            byte[][]         rops;
            uint[][]         serverHandleObjectsTables;

            if (ret == OxcRpcErrorCode.ECNone)
            {
                this.ParseResponseBuffer(rgbRopOut, out rpcHeaderExts, out rops, out serverHandleObjectsTables);

                // Deserialize rops
                if (rops != null)
                {
                    foreach (byte[] rop in rops)
                    {
                        List <IDeserializable> ropResponses = new List <IDeserializable>();
                        RopDeserializer.Deserialize(rop, ref ropResponses);
                        foreach (IDeserializable ropResponse in ropResponses)
                        {
                            responseROPs.Add(ropResponse);
                            Type type = ropResponse.GetType();
                            this.site.Log.Add(LogEntryKind.Comment, "Response: {0}", type.Name);
                        }

                        this.site.Log.Add(LogEntryKind.Comment, Common.FormatBinaryDate(rop));
                    }
                }

                // Deserialize serverHandleObjectsTables
                if (serverHandleObjectsTables != null)
                {
                    foreach (uint[] serverHandleObjectsTable in serverHandleObjectsTables)
                    {
                        List <uint> serverHandleObjectList = new List <uint>();
                        foreach (uint serverHandleObject in serverHandleObjectsTable)
                        {
                            serverHandleObjectList.Add(serverHandleObject);
                        }

                        responseSOHTable.Add(serverHandleObjectList);
                    }
                }

                // The return value 0x478 means that the client needs to reconnect server with server name in response
                if (this.MapiContext.AutoRedirect && rops.Length > 0 && rops[0][0] == 0xfe && ((RopLogonResponse)responseROPs[0]).ReturnValue == 0x478)
                {
                    // Reconnect server with returned server name
                    string serverName = Encoding.ASCII.GetString(((RopLogonResponse)responseROPs[0]).ServerName);
                    serverName = serverName.Substring(serverName.LastIndexOf("=") + 1);

                    responseROPs.Clear();
                    responseSOHTable.Clear();

                    bool disconnectReturnValue = this.Disconnect();
                    this.site.Assert.IsTrue(disconnectReturnValue, "Disconnect should be successful here.");

                    string rpcProxyOptions = null;
                    if (string.Compare(this.MapiContext.TransportSequence, "ncacn_http", true) == 0)
                    {
                        rpcProxyOptions = "RpcProxy=" + this.originalServerName + "." + this.domainName;

                        bool connectionReturnValue = this.RpcConnect(serverName, this.userDN, this.domainName, this.userName, this.userPassword, rpcProxyOptions);
                        this.site.Assert.IsTrue(connectionReturnValue, "RpcConnect_Internal should be successful here.");
                    }
                    else if (string.Compare(this.MapiContext.TransportSequence, "mapi_http", true) == 0)
                    {
                        if (mailBoxUserName == null)
                        {
                            mailBoxUserName = Common.GetConfigurationPropertyValue("AdminUserName", this.site);
                            if (mailBoxUserName == null || mailBoxUserName == "")
                            {
                                this.site.Assert.Fail(@"There must be ""AdminUserName"" configure item in the ptfconfig file.");
                            }
                        }

                        string requestURL = Common.GetConfigurationPropertyValue("AutoDiscoverUrlFormat", this.site);
                        requestURL = Regex.Replace(requestURL, @"\[ServerName\]", this.originalServerName, RegexOptions.IgnoreCase);
                        string publicFolderMailbox = Common.GetConfigurationPropertyValue("PublicFolderMailbox", this.site);
                        AutoDiscoverProperties autoDiscoverProperties = AutoDiscover.GetAutoDiscoverProperties(this.site, this.originalServerName, mailBoxUserName, this.domainName, requestURL, this.MapiContext.TransportSequence.ToLower(), publicFolderMailbox);

                        this.privateMailboxServer      = autoDiscoverProperties.PrivateMailboxServer;
                        this.privateMailboxProxyServer = autoDiscoverProperties.PrivateMailboxProxy;
                        this.publicFolderServer        = autoDiscoverProperties.PublicMailboxServer;
                        this.publicFolderProxyServer   = autoDiscoverProperties.PublicMailboxProxy;
                        this.privateMailStoreUrl       = autoDiscoverProperties.PrivateMailStoreUrl;
                        this.publicFolderUrl           = autoDiscoverProperties.PublicMailStoreUrl;

                        bool connectionReturnValue = this.MapiConnect(this.privateMailStoreUrl, this.userDN, this.domainName, this.userName, this.userPassword);
                        this.site.Assert.IsTrue(connectionReturnValue, "RpcConnect_Internal should be successful here.");
                    }

                    ret = this.RopCall(
                        requestROPs,
                        requestSOHTable,
                        ref responseROPs,
                        ref responseSOHTable,
                        ref rgbRopOut,
                        0x10008);
                }
            }

            return(ret);
        }
 /// <summary>
 /// Initializes the current adapter instance associated with a test site.
 /// </summary>
 /// <param name="testSite">The test site instance associated with the current adapter.</param>
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
     testSite.DefaultProtocolDocShortName = "MS-OXNSPI";
     Common.MergeConfiguration(testSite);
     AdapterHelper.Site = testSite;
     if (bool.Parse(Common.GetConfigurationPropertyValue("MS-OXNSPI_Supported", this.Site)))
     {
         this.nspiRpcAdapter = null;
         this.nspiMapiHttpAdapter = null;
         this.originalServerName = Common.GetConfigurationPropertyValue("SutComputerName", this.Site);
         this.userName = Common.GetConfigurationPropertyValue("User1Name", this.Site);
         this.Site.Assume.IsNotNull(this.userName, "The User1Name field in the ptfconfig file should not be null.");
         this.Site.Assume.IsNotNull(Common.GetConfigurationPropertyValue("User2Name", this.Site), "The User2Name field in the ptfconfig file should not be null.");
         this.Site.Assume.IsNotNull(Common.GetConfigurationPropertyValue("User3Name", this.Site), "The User3Name field in the ptfconfig file should not be null.");
         this.domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
         this.password = Common.GetConfigurationPropertyValue("User1Password", this.Site);
         string requestURL = Common.GetConfigurationPropertyValue("AutoDiscoverUrlFormat", this.Site);
         requestURL = Regex.Replace(requestURL, @"\[ServerName\]", this.originalServerName, RegexOptions.IgnoreCase);
         this.transport = Common.GetConfigurationPropertyValue("TransportSeq", this.Site).ToLower(System.Globalization.CultureInfo.CurrentCulture);
         this.Site.Assert.IsTrue(this.transport == "mapi_http" || this.transport == "ncacn_http" || this.transport == "ncacn_ip_tcp", @"The TransportSeq field in the ptfconfig file must be set to one of the following three values: mapi_http, ncacn_http and ncacn_ip_tcp.");
         this.waitTime = Convert.ToInt32(Common.GetConfigurationPropertyValue("WaitTime", testSite));
         this.maxRetryCount = Convert.ToUInt32(Common.GetConfigurationPropertyValue("RetryCount", testSite));
         AdapterHelper.Transport = this.transport;
         if (this.transport == "ncacn_http" || this.transport == "ncacn_ip_tcp")
         {
             this.InitializeRPC();
             this.nspiRpcAdapter = new NspiRpcAdapter(this.Site, this.rpcBinding, this.contextHandle, this.waitTime, this.maxRetryCount);
         }
         else
         {
             AdapterHelper.SessionContextCookies = new CookieCollection();
             this.autoDiscoverProperties = AutoDiscover.GetAutoDiscoverProperties(this.Site, this.originalServerName, this.userName, this.domainName, requestURL, this.transport);
             this.Site.Assert.IsNotNull(this.autoDiscoverProperties.AddressBookUrl, @"The auto discover process should return the URL to be used to connect with a NSPI server through MAPI over HTTP successfully.");
             this.nspiMapiHttpAdapter = new NspiMapiHttpAdapter(this.Site, this.userName, this.password, this.domainName, this.autoDiscoverProperties.AddressBookUrl);
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Connect to the server for running ROP commands.
        /// </summary>
        /// <param name="server">Server to connect.</param>
        /// <param name="connectionType">the type of connection</param>
        /// <param name="userDN">UserDN used to connect server</param>
        /// <param name="domain">Domain name</param>
        /// <param name="userName">User name used to logon</param>
        /// <param name="password">User Password</param>
        /// <returns>Result of connecting.</returns>
        public bool Connect(string server, ConnectionType connectionType, string userDN, string domain, string userName, string password)
        {
            this.privateMailboxServer      = null;
            this.privateMailboxProxyServer = null;
            this.publicFolderServer        = null;
            this.publicFolderProxyServer   = null;
            this.privateMailStoreUrl       = null;
            this.publicFolderUrl           = null;

            this.userName           = userName;
            this.userDN             = userDN;
            this.userPassword       = password;
            this.domainName         = domain;
            this.originalServerName = server;

            if ((this.MapiContext.AutoRedirect == true) && (Common.GetConfigurationPropertyValue("UseAutodiscover", this.site).ToLower() == "true"))
            {
                string requestURL = Common.GetConfigurationPropertyValue("AutoDiscoverUrlFormat", this.site);
                requestURL = Regex.Replace(requestURL, @"\[ServerName\]", this.originalServerName, RegexOptions.IgnoreCase);
                string publicFolderMailbox = Common.GetConfigurationPropertyValue("PublicFolderMailbox", this.site);
                AutoDiscoverProperties autoDiscoverProperties = AutoDiscover.GetAutoDiscoverProperties(this.site, this.originalServerName, this.userName, this.domainName, requestURL, this.MapiContext.TransportSequence.ToLower(), publicFolderMailbox);

                this.privateMailboxServer      = autoDiscoverProperties.PrivateMailboxServer;
                this.privateMailboxProxyServer = autoDiscoverProperties.PrivateMailboxProxy;
                this.publicFolderServer        = autoDiscoverProperties.PublicMailboxServer;
                this.publicFolderProxyServer   = autoDiscoverProperties.PublicMailboxProxy;
                this.privateMailStoreUrl       = autoDiscoverProperties.PrivateMailStoreUrl;
                this.publicFolderUrl           = autoDiscoverProperties.PublicMailStoreUrl;
            }
            else
            {
                if (this.MapiContext.TransportSequence.ToLower() == "mapi_http")
                {
                    this.site.Assert.Fail("When the value of TransportSeq is set to mapi_http, the value of UseAutodiscover must be set to true.");
                }
                else
                {
                    this.publicFolderServer   = server;
                    this.privateMailboxServer = server;
                }
            }

            bool ret = false;

            switch (this.MapiContext.TransportSequence.ToLower())
            {
            case "mapi_http":
                if (connectionType == ConnectionType.PrivateMailboxServer)
                {
                    ret = this.MapiConnect(this.privateMailStoreUrl, userDN, domain, userName, password);
                }
                else
                {
                    ret = this.MapiConnect(this.publicFolderUrl, userDN, domain, userName, password);
                }

                break;

            case "ncacn_ip_tcp":
            case "ncacn_http":
                if (connectionType == ConnectionType.PrivateMailboxServer)
                {
                    ret = this.RpcConnect(this.privateMailboxServer, userDN, domain, userName, password, this.privateMailboxProxyServer);
                }
                else
                {
                    ret = this.RpcConnect(this.publicFolderServer, userDN, domain, userName, password, this.publicFolderProxyServer);
                }

                break;

            default:
                this.site.Assert.Fail("TransportSeq \"{0}\" is not supported by the test suite.");
                break;
            }

            return(ret);
        }
        /// <summary>
        /// Get auto discover properties for server name and proxy name
        /// </summary>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions,
        /// and adapters for test code onto its execution context.</param>
        /// <param name="server">Server to connect.</param>
        /// <param name="userName">User name used to logon.</param>
        /// <param name="domain">Domain name.</param>
        /// <param name="requestURL">The server url address to receive the request from clien.</param>
        /// <param name="transport">The current transport used in the test suite.</param>
        /// <returns>Returns the structure contains auto discover properties.</returns>
        public static AutoDiscoverProperties GetAutoDiscoverProperties(
            ITestSite site,
            string server,
            string userName,
            string domain,
            string requestURL,
            string transport)
        {
            HttpStatusCode httpStatusCode = HttpStatusCode.Unused;
            XmlDocument doc = new XmlDocument();
            XmlNodeList elemList = null;
            string requestXML = string.Empty;
            string responseXML = string.Empty;

            AutoDiscoverProperties autoDiscoverProperties = new AutoDiscoverProperties
            {
                PrivateMailboxServer = null,
                PrivateMailboxProxy = null,

                PublicMailboxServer = null,
                PublicMailboxProxy = null,

                PublicMailStoreUrl = null,
                PrivateMailStoreUrl = null,

                AddressBookUrl = null
            };

            // Get auto discover properties for private mailbox
            requestXML = "<Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006\">" +
                "<Request><EMailAddress>" + userName + "@" + domain + "</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>";

            if (transport == "mapi_http")
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, true);
                site.Assert.AreEqual<HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);

                elemList = doc.GetElementsByTagName("MailStore");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "MailStore element should exist in response.");
                string mailStoreUrl = GetMAPIInternalURLProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(mailStoreUrl), "The mailstore internal URL should be gotten under MailStore element");
                autoDiscoverProperties.PrivateMailStoreUrl = mailStoreUrl; // Add private mailbox server

                elemList = doc.GetElementsByTagName("AddressBook");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "AddressBook element should exist in response.");
                string addressBookUri = GetMAPIInternalURLProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(addressBookUri), "The AddressBook internal URL should be gotten under AddressBook element");
                autoDiscoverProperties.AddressBookUrl = addressBookUri;
            }
            else
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, false);
                site.Assert.AreEqual<HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);

                elemList = doc.GetElementsByTagName("PublicFolderInformation");
                if (elemList == null || elemList.Count == 0)
                {
                    // Not found PublicFolderInformation means the SUT is not Microsoft Exchange Server 2013, in this case, proxy will not be changed and using original server name.
                    // For Microsoft Exchange Server 2010 the private mailbox server should be same as public folder server
                    autoDiscoverProperties.PrivateMailboxServer = server; // Add private mailbox server
                    autoDiscoverProperties.PublicMailboxServer = server; // Add public mailbox server

                    return autoDiscoverProperties;
                }

                // That the PublicFolderInformation is found means that the SUT is Microsoft Exchange Server 2013, in this case, get server name and proxy information for both private mailbox and public folder.
                elemList = doc.GetElementsByTagName("Protocol");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "Protocol element should exist in response.");

                string privateMailboxServer = GetServerNameProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(privateMailboxServer), "The private mailbox server name should be gotten under Protocol element");

                string privateMailboxProxy = GetServerProxyProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(privateMailboxProxy), "The private mailbox server proxy should be gotten under Protocol element");

                autoDiscoverProperties.PrivateMailboxServer = privateMailboxServer; // Add private mailbox server
                autoDiscoverProperties.PrivateMailboxProxy = privateMailboxProxy; // Add private mailbox proxy
            }

            // Get auto discover properties for public mailbox
            string smtpAddress = "PublicFolderMailbox_" + server + "@" + domain;
            requestXML = "<Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006\">" +
                "<Request><EMailAddress>" + smtpAddress + "</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>";
            responseXML = string.Empty;

            if (transport == "mapi_http")
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, true);
                site.Assert.AreEqual<HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);

                elemList = doc.GetElementsByTagName("MailStore");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "MailStore element should exist in response.");

                string publicMailStoreUrl = GetMAPIInternalURLProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(publicMailStoreUrl), "The public folder mailbox server name should be gotten under MailStore element");

                autoDiscoverProperties.PublicMailStoreUrl = publicMailStoreUrl; // Add public mailbox server
            }
            else
            {
                httpStatusCode = SendHttpPostRequest(site, userName, domain, requestXML, requestURL, out responseXML, false);
                site.Assert.AreEqual<HttpStatusCode>(HttpStatusCode.OK, httpStatusCode, "Http status code should be 200 (OK), the error code is {0}", httpStatusCode);
                doc.LoadXml(responseXML);
                elemList = doc.GetElementsByTagName("Protocol");
                site.Assert.IsTrue(elemList != null && elemList.Count > 0, "There should be an element called Protocol.");

                string publicMailboxServer = GetServerNameProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(publicMailboxServer), "The public folder mailbox server name should be gotten under Protocol element");

                string publicMailboxProxy = GetServerProxyProperty(elemList);
                site.Assert.IsFalse(string.IsNullOrEmpty(publicMailboxProxy), "The public folder mailbox server proxy should be gotten under Protocol element");

                autoDiscoverProperties.PublicMailboxServer = publicMailboxServer; // Add public mailbox server
                autoDiscoverProperties.PublicMailboxProxy = publicMailboxProxy; // Add public mailbox proxy
            }

            return autoDiscoverProperties;
        }