A class indicates the response body of GetMailboxUrl request
Inheritance: AddressBookResponseBodyBase
コード例 #1
0
        /// <summary>
        /// Parse the GetAddressBookUrl request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The GetAddressBookUrl request type response body.</returns>
        public static GetAddressBookUrlResponseBody Parse(byte[] rawData)
        {
            GetAddressBookUrlResponseBody responseBody = new GetAddressBookUrlResponseBody();
            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 GetAddressBookUrl request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The GetAddressBookUrl request type response body.</returns>
        public static GetAddressBookUrlResponseBody Parse(byte[] rawData)
        {
            GetAddressBookUrlResponseBody responseBody = new GetAddressBookUrlResponseBody();
            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;
        }
コード例 #3
0
        /// <summary>
        /// This method is used by the client to get the URL of the specified address book server endpoint.
        /// </summary>
        /// <param name="getAddressBookUrlRequestBody">The GetAddressBookUrl request type request body.</param>
        /// <returns>The response body of GetAddressBookUrl request type.</returns>
        public GetAddressBookUrlResponseBody GetAddressBookUrl(GetAddressBookUrlRequestBody getAddressBookUrlRequestBody)
        {
            CommonResponse commonResponse = this.SendAddressBookRequest(getAddressBookUrlRequestBody, RequestType.GetAddressBookUrl, cookieChange: false);
            GetAddressBookUrlResponseBody getAddressBookUrlResponseBody = GetAddressBookUrlResponseBody.Parse(commonResponse.ResponseBodyRawData);

            this.VerifyGetAddressBookUrlResponseBody(getAddressBookUrlResponseBody);

            return(getAddressBookUrlResponseBody);
        }
コード例 #4
0
        /// <summary>
        /// Verify GetAddressBookUrl response body related requirements
        /// </summary>
        /// <param name="getAddressBookUrlResponseBody">The GetAddressBookUrl response body to be verified.</param>
        private void VerifyGetAddressBookUrlResponseBody(GetAddressBookUrlResponseBody getAddressBookUrlResponseBody)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1117");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1117
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getAddressBookUrlResponseBody.StatusCode,
                typeof(uint),
                1117,
                @"[In GetAddressBookUrl 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_R1118");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1118
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                getAddressBookUrlResponseBody.StatusCode,
                1118,
                @"[In GetAddressBookUrl 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_R1119");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1119
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getAddressBookUrlResponseBody.ErrorCode,
                typeof(uint),
                1119,
                @"[In GetAddressBookUrl 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_R1120");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1120
            this.Site.CaptureRequirementIfAreEqual<string>(
                getAddressBookUrlResponseBody.ServerUrl,
                this.addressBookUrl + "\0",
                1120,
                @"[In GetAddressBookUrl Request Type  Success Response Body] ServerUrl (variable): A null-terminated Unicode string that specifies the URL of the NSPI server.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1121
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getAddressBookUrlResponseBody.AuxiliaryBufferSize,
                typeof(uint),
                1121,
                @"[In GetAddressBookUrl 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_R1122");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1122
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getAddressBookUrlResponseBody.AuxiliaryBuffer,
                typeof(byte[]),
                1122,
                @"[In GetAddressBookUrl 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_R1123");

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