/// <summary>
/// This method is used by the client to request that the server notify the client when a processing request that takes an extended amount of time completes.
/// </summary>
/// <param name="notificationWaitRequestBody">The request body of the NotificationWait request type.</param>
/// <param name="httpHeaders">The request and response header of the NotificationWait request type.</param>
/// <param name="responseBody">The response body of the NotificationWait request type.</param>
/// <param name="metatags">The meta tags of the NotificationWait request type.</param>
/// <param name="additionalHeader">The additional headers in the Notification request type response.</param>
/// <returns>The status code of the NotificationWait request type.</returns>
public uint NotificationWait(NotificationWaitRequestBody notificationWaitRequestBody, ref WebHeaderCollection httpHeaders, out MailboxResponseBodyBase responseBody, out List <string> metatags, out Dictionary <string, string> additionalHeader)
{
responseBody = null;
byte[] rawBuffer;
// Send the NotificationWait HTTP request and get the response.
HttpWebResponse response = this.SendMAPIHttpRequest(this.userName, this.password, notificationWaitRequestBody, ServerEndpoint.MailboxServerEndpoint, AdapterHelper.SessionContextCookies, 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;
additionalHeader = commonResponse.AdditionalHeaders;
if (responseCode == 0)
{
Site.Assert.IsNotNull(commonResponse.ResponseBodyRawData, "The response body should contains data.");
uint statusCode = BitConverter.ToUInt32(commonResponse.ResponseBodyRawData, 0);
if (statusCode == 0)
{
// Send the NotificationWait request succeeded when the StatusCode field equals zero.
NotificationWaitSuccessResponseBody responseSuccess = NotificationWaitSuccessResponseBody.Parse(commonResponse.ResponseBodyRawData);
responseBody = responseSuccess;
this.VerifyNotificationWaitSuccessResponseBody(responseSuccess);
}
this.VerifyHTTPS(response);
this.VerifyAuthentication(response);
this.VerifyAutoDiscover(response.StatusCode, ServerEndpoint.MailboxServerEndpoint);
this.VerifyHTTPHeaders(response.Headers);
this.VerifyAdditionalHeaders(commonResponse.AdditionalHeaders);
this.VerifyRequestTypesForMailboxServerEndpoint(response.Headers, commonResponse);
this.VerifyResponseMetaTags(commonResponse.MetaTags);
this.VerifyNotificationWaitRequestType(response.Headers);
}
this.VerifyContentTypeHeader(response.Headers);
this.VerifyRespondingToAllRequestTypeRequests(response, commonResponse, responseCode);
response.GetResponseStream().Close();
return(responseCode);
}