A class indicates the response body of GetSpecialTable request
상속: AddressBookResponseBodyBase
        /// <summary>
        /// This method is used by the client to get a special table, which can be either an address book hierarchy table or an address creation table.
        /// </summary>
        /// <param name="getSpecialTableRequestBody">The GetSpecialTable request type request body.</param>
        /// <returns>The response body of the GetSpecialTable request type.</returns>
        public GetSpecialTableResponseBody GetSpecialTable(GetSpecialTableRequestBody getSpecialTableRequestBody)
        {
            CommonResponse commonResponse = this.SendAddressBookRequest(getSpecialTableRequestBody, RequestType.GetSpecialTable);
            GetSpecialTableResponseBody getSpecialTableResponseBody = GetSpecialTableResponseBody.Parse(commonResponse.ResponseBodyRawData);

            this.VerifyGetSpecialTableResponseBody(getSpecialTableResponseBody);

            return(getSpecialTableResponseBody);
        }
        /// <summary>
        /// Parse the GetSpecialTable request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The GetSpecialTable request type response body.</returns>
        public static GetSpecialTableResponseBody Parse(byte[] rawData)
        {
            GetSpecialTableResponseBody responseBody = new GetSpecialTableResponseBody();
            int index = 0;

            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.CodePage = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.HasVersion = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasVersion)
            {
                responseBody.Version = BitConverter.ToUInt32(rawData, index);
                index += sizeof(uint);
            }
            else
            {
                responseBody.Version = null;
            }

            responseBody.HasRows = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasRows)
            {
                responseBody.RowCount = BitConverter.ToUInt32(rawData, index);
                index            += sizeof(uint);
                responseBody.Rows = new AddressBookPropValueList[(uint)responseBody.RowCount];
                for (int i = 0; i < responseBody.RowCount; i++)
                {
                    responseBody.Rows[i] = AddressBookPropValueList.Parse(rawData, ref index);
                }
            }
            else
            {
                responseBody.RowCount = null;
                responseBody.Rows     = null;
            }

            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 GetSpecialTable request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The GetSpecialTable request type response body.</returns>
        public static GetSpecialTableResponseBody Parse(byte[] rawData)
        {
            GetSpecialTableResponseBody responseBody = new GetSpecialTableResponseBody();
            int index = 0;

            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.CodePage = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.HasVersion = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasVersion)
            {
                responseBody.Version = BitConverter.ToUInt32(rawData, index);
                index += sizeof(uint);
            }
            else
            {
                responseBody.Version = null;
            }

            responseBody.HasRows = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasRows)
            {
                responseBody.RowCount = BitConverter.ToUInt32(rawData, index);
                index += sizeof(uint);
                responseBody.Rows = new AddressBookPropertyValueList[(uint)responseBody.RowCount];
                for (int i = 0; i < responseBody.RowCount; i++)
                {
                    responseBody.Rows[i] = AddressBookPropertyValueList.Parse(rawData, ref index);
                }
            }
            else
            {
                responseBody.RowCount = null;
                responseBody.Rows = null;
            }

            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;
        }
예제 #4
0
        /// <summary>
        /// Verify the GetSpecialTable response body related requirements.
        /// </summary>
        /// <param name="getSpecialTableResponseBody">The GetSpecialTable response body to be verified.</param>
        private void VerifyGetSpecialTableResponseBody(GetSpecialTableResponseBody getSpecialTableResponseBody)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R664");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R664
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.StatusCode,
                typeof(uint),
                664,
                @"[In GetSpecialTable 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_R665");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R665
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                getSpecialTableResponseBody.StatusCode,
                665,
                @"[In GetSpecialTable 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_R666");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R666
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.ErrorCode,
                typeof(uint),
                666,
                @"[In GetSpecialTable 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_R667");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R667
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.CodePage,
                typeof(uint),
                667,
                @"[In GetSpecialTable Request Type  Success Response Body] CodePage (4 bytes): An unsigned integer that specifies the code page the server used to express string properties.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R668
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.HasVersion,
                typeof(bool),
                668,
                @"[In GetSpecialTable Request Type  Success Response Body] HasVersion (1 byte): A Boolean value that specifies whether the Version field is present.");

            if (getSpecialTableResponseBody.HasVersion)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R670");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R670
                this.Site.CaptureRequirementIfIsNotNull(
                    getSpecialTableResponseBody.Version,
                    670,
                    @"[In GetSpecialTable Request Type  Success Response Body] [Version] This field is present when the value of the HasVersion field is nonzero.");

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

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R669
                this.Site.CaptureRequirementIfIsInstanceOfType(
                    getSpecialTableResponseBody.Version,
                    typeof(uint),
                    669,
                    @"[In GetSpecialTable Request Type  Success Response Body] Version (optional) (4 bytes): An unsigned integer that specifies the version number of the address book hierarchy table that the server has.");
            }
                        
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R672");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R672
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.HasRows,
                typeof(bool),
                672,
                @"[In GetSpecialTable Request Type  Success Response Body] HasRows (1 byte): A Boolean value that specifies whether the RowCount and Rows fields are present.");

            if (getSpecialTableResponseBody.HasRows)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R675");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R675
                this.Site.CaptureRequirementIfIsNotNull(
                    getSpecialTableResponseBody.RowCount,
                    675,
                    @"[In GetSpecialTable Request Type  Success Response Body] [RowsCount] This field is present when the value of the HasRows field is nonzero.");
                
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R673");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R673
                this.Site.CaptureRequirementIfIsInstanceOfType(
                    getSpecialTableResponseBody.RowCount,
                    typeof(uint),
                    673,
                    @"[In GetSpecialTable Request Type  Success Response Body] RowsCount (optional) (4 bytes): An unsigned integer that specifies the number of structures in the Rows field.");

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

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R678
                this.Site.CaptureRequirementIfIsNotNull(
                    getSpecialTableResponseBody.Rows,
                    678,
                    @"[In GetSpecialTable Request Type  Success Response Body] [Rows] This field is present when the value of the HasRows field is nonzero.");
            }
            else
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1452");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1452
                this.Site.CaptureRequirementIfIsNull(
                    getSpecialTableResponseBody.RowCount,
                    1452,
                    @"[In GetSpecialTable Request Type  Success Response Body] [RowsCount] This field is not present when the value of the HasRows field is zero.");

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

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R679
                this.Site.CaptureRequirementIfIsNull(
                    getSpecialTableResponseBody.Rows,
                    679,
                    @"[In GetSpecialTable Request Type  Success Response Body] [Rows] This field is not present when the value of the HasRows field is zero.");
            }

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R680
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.AuxiliaryBufferSize,
                typeof(uint),
                680,
                @"[In GetSpecialTable 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_R681");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R681
            this.Site.CaptureRequirementIfIsInstanceOfType(
                getSpecialTableResponseBody.AuxiliaryBuffer,
                typeof(byte[]),
                681,
                @"[In GetSpecialTable 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_R682");

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