A disconnect request body for Mailbox Server Endpoint.
Наследование: MailboxRequestBodyBase
        /// <summary>
        /// This method sends the disconnect request through MAPIHTTP transport to the server.
        /// </summary>
        /// <returns>If the method succeeds, the return value is 0. If the method fails, the return value is an implementation-specific error code.</returns>
        public uint Disconnect()
        {
            uint returnValue = 0;
            DisconnectRequestBody disconnectBody = new DisconnectRequestBody();

            disconnectBody.AuxiliaryBufferSize = 0;
            disconnectBody.AuxiliaryBuffer     = new byte[] { };
            HttpWebResponse response         = SendMAPIHttpRequest(this.site, this.mailStoreUrl, this.userName, this.domain, this.userPassword, disconnectBody, "Disconnect", this.cookies);
            string          transferEncoding = response.Headers["Transfer-Encoding"];
            string          pendingInterval  = response.Headers["X-PendingPeriod"];
            string          responseCode     = response.Headers["X-ResponseCode"];

            if (transferEncoding != null)
            {
                if (string.Compare(transferEncoding, "chunked") == 0)
                {
                    byte[] rawBuffer = ReadHttpResponse(response);

                    if (uint.Parse(responseCode) == 0)
                    {
                        ChunkedResponse chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer);
                        DisconnectSuccessResponseBody responseSuccess = DisconnectSuccessResponseBody.Parse(chunkedResponse.ResponseBodyRawData);
                        returnValue = responseSuccess.ErrorCode;
                    }
                }
            }

            response.GetResponseStream().Close();
            this.cookies = null;

            return(returnValue);
        }
        /// <summary>
        /// This method sends the disconnect request through MAPIHTTP transport to the server.
        /// </summary>
        /// <returns>If the method succeeds, the return value is 0. If the method fails, the return value is an implementation-specific error code.</returns>
        public uint Disconnect()
        {
            uint returnValue = 0;
            DisconnectRequestBody disconnectBody = new DisconnectRequestBody();
            disconnectBody.AuxiliaryBufferSize = 0;
            disconnectBody.AuxiliaryBuffer = new byte[] { };
            HttpWebResponse response = SendMAPIHttpRequest(this.site, this.mailStoreUrl, this.userName, this.domain, this.userPassword, disconnectBody, "Disconnect", this.cookies);
            string transferEncoding = response.Headers["Transfer-Encoding"];
            string pendingInterval = response.Headers["X-PendingPeriod"];
            string responseCode = response.Headers["X-ResponseCode"];

            if (transferEncoding != null)
            {
                if (string.Compare(transferEncoding, "chunked") == 0)
                {
                    byte[] rawBuffer = ReadHttpResponse(response);

                    if (uint.Parse(responseCode) == 0)
                    {
                        ChunkedResponse chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer);
                        DisconnectSuccessResponseBody responseSuccess = DisconnectSuccessResponseBody.Parse(chunkedResponse.ResponseBodyRawData);
                        returnValue = responseSuccess.ErrorCode;
                    }
                }
            }
            
            response.GetResponseStream().Close();
            this.cookies = null;

            return returnValue;
        }
        /// <summary>
        /// This method is used by the client to delete a Session Context with the server.
        /// </summary>
        /// <param name="responseBody">The response body of the Disconnect request type.</param>
        /// <returns>The status code of the Disconnect request type.</returns>
        public uint Disconnect(out MailboxResponseBodyBase responseBody)
        {
            responseBody = null;
            byte[] rawBuffer;
            
            // Prepare the disconnect request body.
            DisconnectRequestBody disconnectRequestBody = new DisconnectRequestBody();
            byte[] rgbAuxIn = new byte[] { };
            disconnectRequestBody.AuxiliaryBufferSize = (uint)rgbAuxIn.Length;
            disconnectRequestBody.AuxiliaryBuffer = rgbAuxIn;
            WebHeaderCollection webHeaderCollection = AdapterHelper.InitializeHTTPHeader(RequestType.Disconnect, AdapterHelper.ClientInstance, AdapterHelper.Counter); 

            // Send the disconnect HTTP request and get the response.
            HttpWebResponse response = this.SendMAPIHttpRequest(this.userName, this.password, disconnectRequestBody, ServerEndpoint.MailboxServerEndpoint, AdapterHelper.SessionContextCookies, webHeaderCollection, out rawBuffer);
            uint responseCode = AdapterHelper.GetFinalResponseCode(response.Headers["X-ResponseCode"]);

            // Read the HTTP response buffer and parse the response to correct format.
            CommonResponse commonResponse = CommonResponse.ParseCommonResponse(rawBuffer);
            if (responseCode == 0)
            {
                Site.Assert.IsNotNull(commonResponse.ResponseBodyRawData, "The response body should contains data.");
                uint statusCode = BitConverter.ToUInt32(commonResponse.ResponseBodyRawData, 0);
                if (statusCode == 0)
                {
                    // Disconnect succeeded when the StatusCode field equals zero.
                    DisconnectSuccessResponseBody responseSuccess = DisconnectSuccessResponseBody.Parse(commonResponse.ResponseBodyRawData);
                    responseBody = responseSuccess;

                    this.VerifyDisconnectSuccessResponseBody(responseSuccess);
                }
                
                this.VerifyHTTPS(response);
                this.VerifyAuthentication(response);
                this.VerifyAutoDiscover(response.StatusCode, ServerEndpoint.MailboxServerEndpoint);
                this.VerifyHTTPHeaders(response.Headers);
                this.VerifyAdditionalHeaders(commonResponse.AdditionalHeaders);
                this.VerifyDisconnectResponse(response);
                this.VerifyRequestTypesForMailboxServerEndpoint(response.Headers, commonResponse);
                this.VerifyResponseMetaTags(commonResponse.MetaTags);
            }

            this.VerifyContentTypeHeader(response.Headers);
            this.VerifyRespondingToAllRequestTypeRequests(response, commonResponse, responseCode);
            response.GetResponseStream().Close();
            AdapterHelper.SessionContextCookies = response.Cookies;
            return responseCode;
        }