Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.ResortRestrictionResponseBody.Parse C# (CSharp) Method

Parse() public static method

Parse the ResortRestriction request type response body.
public static Parse ( byte rawData ) : ResortRestrictionResponseBody
rawData byte The raw data of response.
return ResortRestrictionResponseBody
        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;
        }
    }

Usage Example

        /// <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);
        }
ResortRestrictionResponseBody