Inheritance: AddressBookPropertyValue
        /// <summary>
        /// Parse the AddressBookPropertyValueList structure.
        /// </summary>
        /// <param name="rawData">The raw data of response buffer.</param>
        /// <param name="index">The start index.</param>
        /// <returns>Instance of the AddressBookPropertyValueList.</returns>
        public static AddressBookPropertyValueList Parse(byte[] rawData, ref int index)
        {
            AddressBookPropertyValueList addressBookPropValueList = new AddressBookPropertyValueList();
            addressBookPropValueList.PropertyValueCount = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            Context.Instance.PropertyBytes = rawData;
            Context.Instance.CurIndex = index;
            Context.Instance.CurProperty = new Property(PropertyType.PtypUnspecified);

            addressBookPropValueList.PropertyValues = new AddressBookTaggedPropertyValue[addressBookPropValueList.PropertyValueCount];
            for (int i = 0; i < addressBookPropValueList.PropertyValueCount; i++)
            {
                // Parse the AddressBookTaggedPropertyValue from the response buffer.
                AddressBookTaggedPropertyValue taggedPropertyValue = new AddressBookTaggedPropertyValue();
                taggedPropertyValue.Parse(Context.Instance);
                addressBookPropValueList.PropertyValues[i] = taggedPropertyValue;
            }

            index = Context.Instance.CurIndex;

            return addressBookPropValueList;
        }
Example #2
0
        /// <summary>
        /// Parse the AddressBookPropertyValueList structure.
        /// </summary>
        /// <param name="rawData">The raw data of response buffer.</param>
        /// <param name="index">The start index.</param>
        /// <returns>Instance of the AddressBookPropertyValueList.</returns>
        public static AddressBookPropertyValueList Parse(byte[] rawData, ref int index)
        {
            AddressBookPropertyValueList addressBookPropValueList = new AddressBookPropertyValueList();

            addressBookPropValueList.PropertyValueCount = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            Context.Instance.PropertyBytes = rawData;
            Context.Instance.CurIndex      = index;
            Context.Instance.CurProperty   = new Property(PropertyType.PtypUnspecified);

            addressBookPropValueList.PropertyValues = new AddressBookTaggedPropertyValue[addressBookPropValueList.PropertyValueCount];
            for (int i = 0; i < addressBookPropValueList.PropertyValueCount; i++)
            {
                // Parse the AddressBookTaggedPropertyValue from the response buffer.
                AddressBookTaggedPropertyValue taggedPropertyValue = new AddressBookTaggedPropertyValue();
                taggedPropertyValue.Parse(Context.Instance);
                addressBookPropValueList.PropertyValues[i] = taggedPropertyValue;
            }

            index = Context.Instance.CurIndex;

            return(addressBookPropValueList);
        }
        /// <summary>
        /// Verify the AddressBookTaggedPropertyValue structure related requirements.
        /// </summary>
        /// <param name="addressBookTaggedPropertyValue">The AddressBookTaggedPropertyValue value to be verified.</param>
        private void VerifyAddressBookTaggedPropertyValueStructure(AddressBookTaggedPropertyValue addressBookTaggedPropertyValue)
        {
            // Since Test Suite parsed AddressBookTaggedPropertyValue structure according to Specification, if the program run to here, R2011 can be verified directly.
            this.Site.CaptureRequirement(
                2011,
                @"[In AddressBookTaggedPropertyValue Structure] The AddressBookTaggedPropertyValue structure includes property type, property identifier and property value.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2012
            this.Site.CaptureRequirementIfIsInstanceOfType(
                addressBookTaggedPropertyValue.PropertyType,
                typeof(ushort),
                2012,
                @"[In AddressBookTaggedPropertyValue Structure] PropertyType (2 bytes): An unsigned integer that identifies the data type of the property value ([MS-OXCDATA] section 2.11.1).");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2013
            this.Site.CaptureRequirementIfIsInstanceOfType(
                addressBookTaggedPropertyValue.PropertyId,
                typeof(ushort),
                2013,
                @"[In AddressBookTaggedPropertyValue Structure] PropertyId (2 bytes): An unsigned integer that identifies the property.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2014
            this.Site.CaptureRequirementIfIsInstanceOfType(
                addressBookTaggedPropertyValue,
                typeof(AddressBookPropertyValue),
                2014,
                @"[In AddressBookTaggedPropertyValue Structure] PropertyValue (variable): An AddressBookPropertyValue structure, see section 2.2.1.1.");

        }
        /// <summary>
        /// Initialize ModProps request body.
        /// </summary>
        /// <param name="hasState">A Boolean value that specifies whether the State field is present.</param>
        /// <param name="stat">A STAT structure that specifies the state of a specific address book container.</param>
        /// <param name="hasPropertyValues">A Boolean value that specifies whether the PropertyValues field is present.</param>
        /// <param name="propertyTag">A property tag both identifies a property and gives the data type its value.</param>
        /// <param name="hasPropertyTagsToRemove">A Boolean value that specifies whether the PropertyTagsToRemove field is present.</param>
        /// <param name="propertyTagsToRemove">A LargePropTagArray structure that specifies the properties that the client is requesting to be removed. </param>
        /// <returns>Returns the ModProps request body.</returns>
        private ModPropsRequestBody BuildModPropsRequestBody(bool hasState, STAT stat, bool hasPropertyValues, PropertyTag propertyTag, bool hasPropertyTagsToRemove, LargePropertyTagArray propertyTagsToRemove)
        {
            ModPropsRequestBody modPropsRequestBody = new ModPropsRequestBody();
            modPropsRequestBody.Reserved = 0x0;
            byte[] auxIn = new byte[] { };
            modPropsRequestBody.AuxiliaryBuffer = auxIn;
            modPropsRequestBody.AuxiliaryBufferSize = (uint)auxIn.Length;

            modPropsRequestBody.HasState = hasState;
            if (hasState)
            {
                modPropsRequestBody.State = stat;
            }

            modPropsRequestBody.HasPropertyValues = hasPropertyValues;
            if (hasPropertyValues)
            {
                AddressBookPropertyValueList addressBookProperties = new AddressBookPropertyValueList();

                addressBookProperties.PropertyValueCount = 1;

                AddressBookTaggedPropertyValue[] taggedPropertyValues = new AddressBookTaggedPropertyValue[1];
                AddressBookTaggedPropertyValue taggedPropertyValue = new AddressBookTaggedPropertyValue();

                taggedPropertyValue.PropertyType = propertyTag.PropertyType;
                taggedPropertyValue.PropertyId = propertyTag.PropertyId;
                taggedPropertyValue.Value = new byte[] { 0x00, 0x00 };
                taggedPropertyValues[0] = taggedPropertyValue;
                addressBookProperties.PropertyValues = taggedPropertyValues;

                modPropsRequestBody.PropertyVaules = addressBookProperties;
            }

            modPropsRequestBody.HasPropertyTagsToRemove = hasPropertyTagsToRemove;
            if (hasPropertyTagsToRemove)
            {
                modPropsRequestBody.PropertyTagsToRemove = propertyTagsToRemove;
            }

            return modPropsRequestBody;
        }