/// <summary> /// This method is used by the client to sort the objects in the restricted address book container. /// </summary> /// <param name="resortRestrictionRequestBody">The ResortRestriction request type request body.</param> /// <returns>The response body of the ResortRestriction request type.</returns> public ResortRestrictionResponseBody ResortRestriction(ResortRestrictionRequestBody resortRestrictionRequestBody) { CommonResponse commonResponse = this.SendAddressBookRequest(resortRestrictionRequestBody, RequestType.ResortRestriction); ResortRestrictionResponseBody resortRestrictionResponseBody = ResortRestrictionResponseBody.Parse(commonResponse.ResponseBodyRawData); this.VerifyResortRestrictionResponseBody(resortRestrictionResponseBody); return(resortRestrictionResponseBody); }
/// <summary> /// Parse the ResortRestriction request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The the ResortRestriction request type response body.</returns> public static ResortRestrictionResponseBody Parse(byte[] rawData) { ResortRestrictionResponseBody responseBody = new ResortRestrictionResponseBody(); int index = 0; responseBody.StatusCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.HasState = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasState) { responseBody.State = STAT.Parse(rawData, ref index); } else { responseBody.State = null; } responseBody.HasMinimalIds = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); List <uint> minimalIdsList = new List <uint>(); if (responseBody.HasMinimalIds) { responseBody.MinimalIdCount = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); for (int i = 0; i < responseBody.MinimalIdCount; i++) { uint minId = BitConverter.ToUInt32(rawData, index); minimalIdsList.Add(minId); index += sizeof(uint); } responseBody.MinimalIds = minimalIdsList.ToArray(); } else { responseBody.MinimalIdCount = null; minimalIdsList = 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 ResortRestriction request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The the ResortRestriction request type response body.</returns> public static ResortRestrictionResponseBody Parse(byte[] rawData) { ResortRestrictionResponseBody responseBody = new ResortRestrictionResponseBody(); int index = 0; responseBody.StatusCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.HasState = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasState) { responseBody.State = STAT.Parse(rawData, ref index); } else { responseBody.State = null; } responseBody.HasMinimalIds = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); List<uint> minimalIdsList = new List<uint>(); if (responseBody.HasMinimalIds) { responseBody.MinimalIdCount = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); for (int i = 0; i < responseBody.MinimalIdCount; i++) { uint minId = BitConverter.ToUInt32(rawData, index); minimalIdsList.Add(minId); index += sizeof(uint); } responseBody.MinimalIds = minimalIdsList.ToArray(); } else { responseBody.MinimalIdCount = null; minimalIdsList = 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> /// Verify the ResortRestriction response body related requirements. /// </summary> /// <param name="resortRestrictionResponseBody">The ResortRestriction response body to be verified.</param> private void VerifyResortRestrictionResponseBody(ResortRestrictionResponseBody resortRestrictionResponseBody) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R993"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R993 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.StatusCode, typeof(uint), 993, @"[In ResortRestriction 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_R994"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R994 this.Site.CaptureRequirementIfAreEqual<uint>( 0, resortRestrictionResponseBody.StatusCode, 994, @"[In ResortRestriction 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_R995"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R995 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.ErrorCode, typeof(uint), 995, @"[In ResortRestriction 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_R996"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R996 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.HasState, typeof(bool), 996, @"[In ResortRestriction Request Type RSuccess esponse Body] HasState (1 byte): A Boolean value that specifies whether the State field is present."); if (resortRestrictionResponseBody.HasState) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R997"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R997 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.State, typeof(STAT), 997, @"[In ResortRestriction Request Type Success Response Body] State (optional) (36 butes): A STAT structure ([MS-OXNSPI] section 2.3.7) that specifies the state of a specific address book container."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R999"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R999 this.Site.CaptureRequirementIfIsNotNull( resortRestrictionResponseBody.State, 999, @"[In ResortRestriction Request Type Success Response Body] [State] This field is present when the HasState field is nonzero."); } else { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1000"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1000 this.Site.CaptureRequirementIfIsNull( resortRestrictionResponseBody.State, 1000, @"[In ResortRestriction Request Type Success Response Body] [State] This field is not present when the HasState field is zero."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1001"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1001 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.HasMinimalIds, typeof(bool), 1001, @"[In ResortRestriction Request Type Success Response Body] HasMinimalIds (1 byte): A Boolean value that specifies whether the MinimalIdCount and MinimalIds fields are present."); if (resortRestrictionResponseBody.HasMinimalIds) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1002"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1002 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.MinimalIdCount, typeof(uint), 1002, @"[In ResortRestriction Request Type Success Response Body] MinimalIdCount (optional) (4 bytes): An unsigned integer that specifies the number of structures present in the Minimalids field."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1005"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1005 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.MinimalIds, typeof(uint[]), 1005, @"[In ResortRestriction Request Type Success Response Body] MinimalIds (optional) (variable): An array of MinimalEntryID structures ([MS-OXNSPI] section 2.3.8.1) that compose a restricted address book container."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1006"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1006 this.Site.CaptureRequirementIfAreEqual<uint>( resortRestrictionResponseBody.MinimalIdCount.Value, (uint)resortRestrictionResponseBody.MinimalIds.Length, 1006, @"[In ResortRestriction Request Type Success Response Body] [MinimalIds] The number of structures contained in this field is specified by the MinimalIdCount field."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1003"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1003 this.Site.CaptureRequirementIfIsNotNull( resortRestrictionResponseBody.MinimalIdCount, 1003, @"[In ResortRestriction Request Type Success Response Body] [MinimalIdCount] This field is present when the value of the HasMinimalIds field is nonzero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1007"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1007 this.Site.CaptureRequirementIfIsNotNull( resortRestrictionResponseBody.MinimalIds, 1007, @"[In ResortRestriction Request Type RSuccess esponse Body] [MinimalIds] This field is present when the value of the HasMinimalIds field is nonzero."); } else { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1004"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1004 this.Site.CaptureRequirementIfIsNull( resortRestrictionResponseBody.MinimalIdCount, 1004, @"[In ResortRestriction Request Type Success Response Body] [MinimalIdCount] This field is not present when the value of the HasMinimalIds field is zero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1008"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1008 this.Site.CaptureRequirementIfIsNull( resortRestrictionResponseBody.MinimalIds, 1008, @"[In ResortRestriction Request Type RSuccess esponse Body] [MinimalIds] This field is not present when the value of the HasMinimalIds field is zero."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1009"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1009 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.AuxiliaryBufferSize, typeof(uint), 1009, @"[In ResortRestriction 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_R1010"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1010 this.Site.CaptureRequirementIfIsInstanceOfType( resortRestrictionResponseBody.AuxiliaryBuffer, typeof(byte[]), 1010, @"[In ResortRestriction 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_R1011"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1011 this.Site.CaptureRequirementIfAreEqual<uint>( resortRestrictionResponseBody.AuxiliaryBufferSize, (uint)resortRestrictionResponseBody.AuxiliaryBuffer.Length, 1011, @"[In ResortRestriction Request Type Success Response Body] [AuxiliaryBuffer] The size of this field, in bytes, is specified by the AuxiliaryBufferSize field."); }