/// <summary> /// Parse the GetTemplateInfo request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The GetTemplateInfo request type response body.</returns> public static GetTemplateInfoResponseBody Parse(byte[] rawData) { GetTemplateInfoResponseBody responseBody = new GetTemplateInfoResponseBody(); 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.HasRow = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasRow) { responseBody.Row = AddressBookPropValueList.Parse(rawData, ref index); } else { responseBody.Row = 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 GetTemplateInfo request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The GetTemplateInfo request type response body.</returns> public static GetTemplateInfoResponseBody Parse(byte[] rawData) { GetTemplateInfoResponseBody responseBody = new GetTemplateInfoResponseBody(); 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.HasRow = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasRow) { responseBody.Row = AddressBookPropertyValueList.Parse(rawData, ref index); } else { responseBody.Row = 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> /// This method is used by the client to get information about a template that is used by the address book. /// </summary> /// <param name="getTemplateInfoRequestBody">The GetTemplateInfo request type request body.</param> /// <returns>The response body of the GetTemplateInfo request type.</returns> public GetTemplateInfoResponseBody GetTemplateInfo(GetTemplateInfoRequestBody getTemplateInfoRequestBody) { CommonResponse commonResponse = this.SendAddressBookRequest(getTemplateInfoRequestBody, RequestType.GetTemplateInfo); GetTemplateInfoResponseBody getTemplateInfoResponseBody = GetTemplateInfoResponseBody.Parse(commonResponse.ResponseBodyRawData); this.VerifyGetTemplateInfoResponseBody(getTemplateInfoResponseBody); return(getTemplateInfoResponseBody); }
/// <summary> /// Verify the GetTemplateInfo response body related requirements. /// </summary> /// <param name="getTemplateInfoResponseBody">The GetTemplateInfo response body to be verified.</param> private void VerifyGetTemplateInfoResponseBody(GetTemplateInfoResponseBody getTemplateInfoResponseBody) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R713"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R713 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.StatusCode, typeof(uint), 713, @"[In GetTemplateInfo 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_R714"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R714 this.Site.CaptureRequirementIfAreEqual<uint>( 0, getTemplateInfoResponseBody.StatusCode, 714, @"[In GetTemplateInfo 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_R715"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R715 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.ErrorCode, typeof(uint), 715, @"[In GetTemplateInfo 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_R716"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R716 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.CodePage, typeof(uint), 716, @"[In GetTemplateInfo Request Type Success Response Body] CodePage (4 bytes): An unsigned integer that specifies the code page the server used to express string values of properties."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R717"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R717 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.HasRow, typeof(bool), 717, @"[In GetTemplateInfo Request Type Success Response Body] HasRow (1 byte): A Boolean value that specifies whether the Rows field is present."); if (getTemplateInfoResponseBody.HasRow) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R719"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R719 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.Row, typeof(AddressBookPropertyValueList), 719, @"[In GetTemplateInfo Request Type Success Response Body] [Row] This field is present when the value of the HasRow field is nonzero."); for (int i = 0; i < getTemplateInfoResponseBody.Row.Value.PropertyValueCount; i++) { this.VerifyAddressBookTaggedPropertyValueStructure(getTemplateInfoResponseBody.Row.Value.PropertyValues[i]); } } else { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R720"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R720 this.Site.CaptureRequirementIfIsNull( getTemplateInfoResponseBody.Row, 720, @"[In GetTemplateInfo Request Type Success Response Body] [Row] This field is not present when the value of the HasRow field is zero."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R721"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R721 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.AuxiliaryBufferSize, typeof(uint), 721, @"[In GetTemplateInfo 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_R722"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R722 this.Site.CaptureRequirementIfIsInstanceOfType( getTemplateInfoResponseBody.AuxiliaryBuffer, typeof(byte[]), 722, @"[In GetTemplateInfo 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_R723"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R723 this.Site.CaptureRequirementIfAreEqual<uint>( getTemplateInfoResponseBody.AuxiliaryBufferSize, (uint)getTemplateInfoResponseBody.AuxiliaryBuffer.Length, 723, @"[In GetTemplateInfo Request Type Success Response Body] [AuxiliaryBuffer] The size of this field, in bytes, is specified by the AuxiliaryBufferSize field."); }