public uint Execute(ExecuteRequestBody requestBody, CookieCollection cookies, ref WebHeaderCollection httpHeaders, out MailboxResponseBodyBase responseBody, out List<string> metatags)
{
responseBody = null;
metatags = null;
byte[] rawBuffer;
// Send the execute HTTP request and get the response.
HttpWebResponse response = this.SendMAPIHttpRequest(this.userName, this.password, requestBody, ServerEndpoint.MailboxServerEndpoint, cookies, httpHeaders, out rawBuffer);
httpHeaders = response.Headers;
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);
metatags = commonResponse.MetaTags;
if (responseCode == 0)
{
Site.Assert.IsNotNull(commonResponse.ResponseBodyRawData, "The response body should contains data.");
uint statusCode = BitConverter.ToUInt32(commonResponse.ResponseBodyRawData, 0);
if (statusCode == 0)
{
// Execute request type executed successfully when the StatusCode field equals zero.
ExecuteSuccessResponseBody responseSuccess = ExecuteSuccessResponseBody.Parse(commonResponse.ResponseBodyRawData);
responseBody = responseSuccess;
this.VerifyHTTPS(response);
this.VerifyExecuteSuccessResponseBody(responseSuccess);
}
this.VerifyHTTPHeaders(response.Headers);
this.VerifyAuthentication(response);
this.VerifyAutoDiscover(response.StatusCode, ServerEndpoint.MailboxServerEndpoint);
this.VerifyAdditionalHeaders(commonResponse.AdditionalHeaders);
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;
}