A class indicates the response body of GetMailboxUrl request
상속: AddressBookResponseBodyBase
        /// <summary>
        /// Parse the GetMailboxUrl request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The the GetMailboxUrl request type response body.</returns>
        public static GetMailboxUrlResponseBody Parse(byte[] rawData)
        {
            GetMailboxUrlResponseBody responseBody = new GetMailboxUrlResponseBody();
            int index = 0;

            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += 4;

            // The length in bytes of the Unicode string to parse
            int strBytesLen = 0;

            // Find the string with '\0''\0' end
            for (int i = index; i < rawData.Length; i += 2)
            {
                strBytesLen += 2;
                if ((rawData[i] == 0) && (rawData[i + 1] == 0))
                {
                    break;
                }
            }

            byte[] serverUrlBuffer = new byte[strBytesLen];
            Array.Copy(rawData, index, serverUrlBuffer, 0, strBytesLen);
            index += strBytesLen;
            responseBody.ServerUrl           = Encoding.Unicode.GetString(serverUrlBuffer);
            responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize];
            Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize);
            return(responseBody);
        }
        /// <summary>
        /// Parse the GetMailboxUrl request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The the GetMailboxUrl request type response body.</returns>
        public static GetMailboxUrlResponseBody Parse(byte[] rawData)
        {
            GetMailboxUrlResponseBody responseBody = new GetMailboxUrlResponseBody();
            int index = 0;
            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += 4;

            // The length in bytes of the Unicode string to parse
            int strBytesLen = 0;

            // Find the string with '\0''\0' end
            for (int i = index; i < rawData.Length; i += 2)
            {
                strBytesLen += 2;
                if ((rawData[i] == 0) && (rawData[i + 1] == 0))
                {
                    break;
                }
            }

            byte[] serverUrlBuffer = new byte[strBytesLen];
            Array.Copy(rawData, index, serverUrlBuffer, 0, strBytesLen);
            index += strBytesLen;
            responseBody.ServerUrl = Encoding.Unicode.GetString(serverUrlBuffer);
            responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize];
            Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize);
            return responseBody;
        }
        /// <summary>
        /// This method is used by the client to get the Uniform Resource Locator (URL) of the specified mailbox server endpoint.
        /// </summary>
        /// <param name="getMailboxUrlRequestBody">The GetMailboxUrl request type request body.</param>
        /// <returns>The response body of the GetMailboxUrl request type.</returns>
        public GetMailboxUrlResponseBody GetMailboxUrl(GetMailboxUrlRequestBody getMailboxUrlRequestBody)
        {
            CommonResponse            commonResponse            = this.SendAddressBookRequest(getMailboxUrlRequestBody, RequestType.GetMailboxUrl, cookieChange: false);
            GetMailboxUrlResponseBody getMailboxUrlResponseBody = GetMailboxUrlResponseBody.Parse(commonResponse.ResponseBodyRawData);

            this.VerifyGetMailboxUrlResponseBody(getMailboxUrlResponseBody);

            return(getMailboxUrlResponseBody);
        }
예제 #4
0
        /// <summary>
        ///  Verify the GetMailboxUrl response body related requirements.
        /// </summary>
        /// <param name="getMailboxUrlResponseBody">The GetMailboxUrl response body to be verified.</param>
        private void VerifyGetMailboxUrlResponseBody(GetMailboxUrlResponseBody getMailboxUrlResponseBody)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1099");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1099
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getMailboxUrlResponseBody.StatusCode,
                typeof(uint),
                1099,
                @"[In GetMailboxUrl Request Type Success Response Body] StatusCode (4 bytes): An unsigned integer that specifies the status of the request.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1100");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1100
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                getMailboxUrlResponseBody.StatusCode,
                1100,
                @"[In GetMailboxUrl Request Type Success Response Body] [StatusCode] This field MUST be set to 0x00000000.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1101");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1101
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getMailboxUrlResponseBody.ErrorCode,
                typeof(uint),
                1101,
                @"[In GetMailboxUrl Request Type Success Response Body] ErrorCode (4 bytes): An unsigned integer that specifies the return status of the operation.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1102");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1102
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getMailboxUrlResponseBody.ServerUrl,
                typeof(string),
                1102,
                @"[In GetMailboxUrl Request Type Success Response Body] ServerUrl (variable): A null-terminated Unicode string that specifies URL of the EMSMDB server.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1103");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1103
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getMailboxUrlResponseBody.AuxiliaryBufferSize,
                typeof(uint),
                1103,
                @"[In GetMailboxUrl Request Type Success Response Body] AuxiliaryBufferSize (4 bytes): An unsigned integer that specifies the size, in bytes, of the AuxiliaryBuffer field.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1104");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1104
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getMailboxUrlResponseBody.AuxiliaryBuffer,
                typeof(byte[]),
                1104,
                @"[In GetMailboxUrl Request Type Success Response Body] AuxiliaryBuffer (variable): An array of bytes that constitute the auxiliary payload data returned from the server.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1105");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1105
            this.Site.CaptureRequirementIfAreEqual<uint>(
                getMailboxUrlResponseBody.AuxiliaryBufferSize,
                (uint)getMailboxUrlResponseBody.AuxiliaryBuffer.Length,
                1105,
                @"[In GetMailboxUrl Request Type Success Response Body] [AuxiliaryBuffer] The size of this field, in bytes, is specified by the AuxiliaryBufferSize field.");
        }