Size() public method

Size of RecipientRow structure.
public Size ( ) : int
return int
        /// <summary>
        /// This method creates Sample RecipientColumns and Sample RecipientRows.
        /// </summary>
        /// <param name="recipientColumns">Sample RecipientColumns</param>
        /// <param name="recipientRows">Sample RecipientRows</param>
        protected void CreateSampleRecipientColumnsAndRecipientRows(out PropertyTag[] recipientColumns, out ModifyRecipientRow[] recipientRows)
        {
            // Step 1: Create Sample RecipientColumns.
            #region recipientColumns

            // The following sample data is from MS-OXCMSG 4.7.1.
            PropertyTag[] sampleRecipientColumns = new PropertyTag[12];
            sampleRecipientColumns[0] = this.propertyDictionary[PropertyNames.PidTagObjectType];
            sampleRecipientColumns[1] = this.propertyDictionary[PropertyNames.PidTagDisplayType];
            sampleRecipientColumns[2] = this.propertyDictionary[PropertyNames.PidTagAddressBookDisplayNamePrintable];
            sampleRecipientColumns[3] = this.propertyDictionary[PropertyNames.PidTagSmtpAddress];
            sampleRecipientColumns[4] = this.propertyDictionary[PropertyNames.PidTagSendInternetEncoding];
            sampleRecipientColumns[5] = this.propertyDictionary[PropertyNames.PidTagDisplayTypeEx];
            sampleRecipientColumns[6] = this.propertyDictionary[PropertyNames.PidTagRecipientDisplayName];
            sampleRecipientColumns[7] = this.propertyDictionary[PropertyNames.PidTagRecipientFlags];
            sampleRecipientColumns[8] = this.propertyDictionary[PropertyNames.PidTagRecipientTrackStatus];
            sampleRecipientColumns[9] = this.propertyDictionary[PropertyNames.PidTagRecipientResourceState];
            sampleRecipientColumns[10] = this.propertyDictionary[PropertyNames.PidTagRecipientOrder];
            sampleRecipientColumns[11] = this.propertyDictionary[PropertyNames.PidTagRecipientEntryId];
            recipientColumns = sampleRecipientColumns;

            #endregion

            // Step 2: Configure a StandardPropertyRow: propertyRow.
            #region Configure a StandardPropertyRow: propertyRow, data is from Page 62 of MS-OXCMSG

            PropertyValue[] propertyValueArray = new PropertyValue[12];
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValueArray[i] = new PropertyValue();
            }

            // PidTagObjectType
            propertyValueArray[0].Value = BitConverter.GetBytes(0x00000006);

            // PidTagDisplayType
            propertyValueArray[1].Value = BitConverter.GetBytes(0x00000000);

            // PidTa7BitDisplayName
            propertyValueArray[2].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "\0");

            // PidTagSmtpAddress
            propertyValueArray[3].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) + "\0");

            // PidTagSendInternetEncoding
            propertyValueArray[4].Value = BitConverter.GetBytes(0x00000000);

            // PidTagDisplayTypeEx
            propertyValueArray[5].Value = BitConverter.GetBytes(0x40000000);

            // PidTagRecipientDisplayName
            propertyValueArray[6].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "\0");

            // PidTagRecipientFlags
            propertyValueArray[7].Value = BitConverter.GetBytes(0x00000001);

            // PidTagRecipientTrackStatus
            propertyValueArray[8].Value = BitConverter.GetBytes(0x00000000);

            // PidTagRecipientResourceState
            propertyValueArray[9].Value = BitConverter.GetBytes(0x00000000);

            // PidTagRecipientOrder
            propertyValueArray[10].Value = BitConverter.GetBytes(0x00000000);

            // The following sample data (0x007c and the subsequent 124(0x7c) binary)
            // is copied from Page 62 of MS-OXCMSG
            byte[] sampleData = 
            { 
                0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xa7, 0x40, 0xc8,
                0xc0, 0x42, 0x10, 0x1a, 0xb4, 0xb9, 0x08, 0x00, 0x2b, 0x2f,
                0xe1, 0x82, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x2f, 0x6f, 0x3d, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x4f,
                0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
                0x6e, 0x2f, 0x6f, 0x75, 0x3d, 0x45, 0x78, 0x63, 0x68, 0x61,
                0x6e, 0x67, 0x65, 0x20, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x69,
                0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x47,
                0x72, 0x6f, 0x75, 0x70, 0x20, 0x28, 0x46, 0x59, 0x44, 0x49,
                0x42, 0x4f, 0x48, 0x46, 0x32, 0x33, 0x53, 0x50, 0x44, 0x4c,
                0x54, 0x29, 0x2f, 0x63, 0x6e, 0x3d, 0x52, 0x65, 0x63, 0x69,
                0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x63, 0x6e, 0x3d,
                0x75, 0x73, 0x65, 0x72, 0x32, 0x00 
            };

            // PidTagRecipientEntryId
            propertyValueArray[11].Value = sampleData;

            List<PropertyValue> propertyValues = new List<PropertyValue>();
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValues.Add(propertyValueArray[i]);
            }

            PropertyRow propertyRow = new PropertyRow
            {
                Flag = (byte)PropertyRowFlag.FlaggedPropertyRow,
                PropertyValues = propertyValues
            };

            // For propertyRow.Flag
            int tempLengthForTest = 1;
            foreach (PropertyValue pv in propertyRow.PropertyValues)
            {
                tempLengthForTest = tempLengthForTest + pv.Value.Length;
            }

            #endregion

            // Step 3: Create Sample RecipientRows.
            #region recipientRows

            RecipientRow recipientRow = new RecipientRow
            {
                // 0101 1001 0000 0110 S,D, Type=SMTP,I,U,E
                RecipientFlags = (ushort)(
                    RecipientFlags.SMTP
                    | RecipientFlags.S
                    | RecipientFlags.D
                    | RecipientFlags.I
                    | RecipientFlags.U
                    | RecipientFlags.E),

                // Set DisplayName, which specifies the Email Address of the recipient, as specified in [MS-OXCDATA].
                // This field is present because D is Set.
                DisplayName = Encoding.Unicode.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0"),

                // Set EmailAddress, which specifies the Email Address of the recipient,
                // as specified in [MS-OXCDATA].
                EmailAddress =
                    Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "@" +
                                              Common.GetConfigurationPropertyValue("Domain", this.Site) + "\0"),

                // Set SimpleDisplayName, which specifies the Email Address of the recipient,
                // as specified in [MS-OXCDATA].
                SimpleDisplayName =
                    Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "\0"),

                // Set RecipientColumnCount, which specifies the number of columns from the RecipientColumns field
                // that are included in RecipientProperties, as specified in [MS-OXCDATA].
                RecipientColumnCount = RecipientColumnCount,
                RecipientProperties = propertyRow
            };
            ModifyRecipientRow modifyRecipientRow = new ModifyRecipientRow
            {
                RowId = RowId, // Set RowId, which value specifies the ID of the recipient.
                RecipientType = (byte)RecipientType.PrimaryRecipient,
                RecipientRowSize = (ushort)recipientRow.Size(), // Set RecipientRowSize, which specifies the size of the RecipientRow field.
                RecptRow = recipientRow.Serialize()
            };
            ModifyRecipientRow[] sampleModifyRecipientRows = new ModifyRecipientRow[1];
            sampleModifyRecipientRows[0] = modifyRecipientRow;
            recipientRows = sampleModifyRecipientRows;

            #endregion
        }
        /// <summary>
        /// Generate recipientColumns value and recipientRows value.
        /// </summary>
        /// <param name="recipientColumns">recipientColumns value.</param>
        /// <param name="recipientRows">recipientRows value.</param>
        private void CreateSampleRecipientColumnsAndRecipientRows(out PropertyTag[] recipientColumns, out ModifyRecipientRow[] recipientRows)
        {
            PropertyTag[] sampleRecipientColumns = new PropertyTag[12];
            PropertyTag tag;

            // PidTagObjectType
            tag.PropertyId = 0x0ffe;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[0] = tag;

            // PidTagDisplayType
            tag.PropertyId = 0x3900;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[1] = tag;

            // PidTagAddressBookDisplayNamePrintable
            tag.PropertyId = 0x39ff;

            // PtypString
            tag.PropertyType = 0x001f;
            sampleRecipientColumns[2] = tag;

            // PidTagSmtpAddress
            tag.PropertyId = 0x39fe;

            // PtypString
            tag.PropertyType = 0x001f;
            sampleRecipientColumns[3] = tag;

            // PidTagSendInternetEncoding
            tag.PropertyId = 0x3a71;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[4] = tag;

            // PidTagDisplayTypeEx
            tag.PropertyId = 0x3905;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[5] = tag;

            // PidTagRecipientDisplayName
            tag.PropertyId = 0x5ff6;
            tag.PropertyType = 0x001f; // PtypString
            sampleRecipientColumns[6] = tag;

            // PidTagRecipientFlags
            tag.PropertyId = 0x5ffd;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[7] = tag;

            // PidTagRecipientTrackStatus
            tag.PropertyId = 0x5fff;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[8] = tag;

            // PidTagRecipientResourceState
            tag.PropertyId = 0x5fde;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[9] = tag;

            // PidTagRecipientOrder
            tag.PropertyId = 0x5fdf;

            // PtypInteger32
            tag.PropertyType = 0x0003;
            sampleRecipientColumns[10] = tag;

            // PidTagRecipientEntryId
            tag.PropertyId = 0x5ff7;

            // PtypBinary
            tag.PropertyType = 0x0102;
            sampleRecipientColumns[11] = tag;

            recipientColumns = sampleRecipientColumns;

            PropertyValue[] propertyValueArray = new PropertyValue[12];
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValueArray[i] = new PropertyValue();
            }

            propertyValueArray[0].Value = BitConverter.GetBytes(0x00000006); // PidTagObjectType
            propertyValueArray[1].Value = BitConverter.GetBytes(0x00000000); // PidTagDisplayType
            propertyValueArray[2].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("AdminUserName", this.Site) + "\0"); // PidTa7BitDisplayName
            propertyValueArray[3].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("AdminUserName", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) + "\0"); // PidTagSmtpAddress
            propertyValueArray[4].Value = BitConverter.GetBytes(0x00000000); // PidTagSendInternetEncoding
            propertyValueArray[5].Value = BitConverter.GetBytes(0x40000000); // PidTagDisplayTypeEx
            propertyValueArray[6].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("AdminUserName", this.Site) + "\0"); // PidTagRecipientDisplayName
            propertyValueArray[7].Value = BitConverter.GetBytes(0x00000001); // PidTagRecipientFlags
            propertyValueArray[8].Value = BitConverter.GetBytes(0x00000000); // PidTagRecipientTrackStatus
            propertyValueArray[9].Value = BitConverter.GetBytes(0x00000000); // PidTagRecipientResourceState
            propertyValueArray[10].Value = BitConverter.GetBytes(0x00000000); // PidTagRecipientOrder

            // EntryId of administrator 
            byte[] sampleData = ConvertStringToBytes(@"0x79,0x00,0x00,0x00,0x00,0x00,0xDC,0xA7,0x40,0xC8,0xC0,0x42
                                                           ,0x10,0x1A,0xB4,0xB9,0x08,0x00,0x2B,0x2F,0xE1,0x82
                                                           ,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2F,0x6F
                                                           ,0x3D,0x63,0x6F,0x6E,0x74,0x6F,0x73,0x6F,0x2F,0x6F
                                                           ,0x75,0x3D,0x45,0x78,0x63,0x68,0x61,0x6E,0x67,0x65
                                                           ,0x20,0x41,0x64,0x6D,0x69,0x6E,0x69,0x73,0x74,0x72
                                                           ,0x61,0x74,0x69,0x76,0x65,0x20,0x47,0x72,0x6F,0x75
                                                           ,0x70,0x20,0x28,0x46,0x59,0x44,0x49,0x42,0x4F,0x48
                                                           ,0x46,0x32,0x33,0x53,0x50,0x44,0x4C,0x54,0x29,0x2F
                                                           ,0x63,0x6E,0x3D,0x52,0x65,0x63,0x69,0x70,0x69,0x65
                                                           ,0x6E,0x74,0x73,0x2F,0x63,0x6E,0x3D,0x41,0x64,0x6D
                                                           ,0x69,0x6E,0x69,0x73,0x74,0x72,0x61,0x74,0x6F,0x72
                                                           ,0x00");
            propertyValueArray[11].Value = sampleData;

            List<PropertyValue> propertyValues = new List<PropertyValue>();
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValues.Add(propertyValueArray[i]);
            }

            PropertyRow propertyRow = new PropertyRow
            {
                Flag = 0x00,
                PropertyValues = propertyValues
            };

            // For propertyRow.Flag.
            int tempLengthForTest = 1;
            foreach (PropertyValue pv in propertyRow.PropertyValues)
            {
                tempLengthForTest = tempLengthForTest + pv.Value.Length;
            }

            RecipientRow recipientRow = new RecipientRow
            {
                RecipientFlags = 0x065B,

                // Present because D is Set.
                DisplayName = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("AdminUserName", this.Site) + "\0"),
                EmailAddress = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("AdminUserName", this.Site) + "@" +
                                              Common.GetConfigurationPropertyValue("Domain", this.Site) + "\0"),
                SimpleDisplayName = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("AdminUserName", this.Site) + "\0"),

                // Matches ColummnCount.
                RecipientColumnCount = 0x000C,
                RecipientProperties = propertyRow
            };

            ModifyRecipientRow modifyRecipientRow = new ModifyRecipientRow
            {
                // Primary Recipient.
                RowId = 0x00000000,
                RecipientType = 0x01,
                RecipientRowSize = (ushort)recipientRow.Size(),

                // Bytes in the following RecipientRow.
                RecptRow = recipientRow.Serialize()
            };

            ModifyRecipientRow[] sampleModifyRecipientRows = new ModifyRecipientRow[1];
            sampleModifyRecipientRows[0] = modifyRecipientRow;
            recipientRows = sampleModifyRecipientRows;
        }
        /// <summary>
        /// Submit a message to the server
        /// </summary>
        /// <param name="mailTo">The user name of the recipient</param>
        /// <param name="mailToUserDN">The userDN of the recipient</param>
        /// <param name="subject">The subject of the mail</param>
        /// <param name="addedProperties">The added properties of the mail</param>
        /// <returns>Return code of the message delivering</returns>
        public uint DeliverMessageToTriggerRule(string mailTo, string mailToUserDN, string subject, TaggedPropertyValue[] addedProperties)
        {
            RopCreateMessageResponse createMsgRes;
            uint msgHandle = this.OxoruleAdapter.RopCreateMessage(outBoxFolderHandle, outBoxFolderID, 0, out createMsgRes);
            TaggedPropertyValue[] clientSpecificProperties = new TaggedPropertyValue[1];
            clientSpecificProperties[0] = new TaggedPropertyValue();
            PropertyTag propertyTag = new PropertyTag
            {
                PropertyId = (ushort)PropertyId.PidTagSubject,
                PropertyType = (ushort)PropertyType.PtypString
            };
            clientSpecificProperties[0].PropertyTag = propertyTag;
            clientSpecificProperties[0].Value = Encoding.Unicode.GetBytes(subject + "\0");
            this.OxoruleAdapter.RopSetProperties(msgHandle, clientSpecificProperties);
            if (addedProperties != null && addedProperties.Length > 0)
            {
                this.OxoruleAdapter.RopSetProperties(msgHandle, addedProperties);
            }

            #region recipientColumns,  PropertyTag[] sampleRecipientColumns
            // The following sample data is from MS-OXCMSG 4.7.1
            PropertyTag[] sampleRecipientColumns = new PropertyTag[12];
            PropertyTag tag = new PropertyTag
            {
                PropertyId = (ushort)PropertyId.PidTagObjectType,
                PropertyType = (ushort)PropertyType.PtypInteger32
            };

            // PidTagObjectType
            sampleRecipientColumns[0] = tag;

            // PidTagDisplayType
            tag.PropertyId = (ushort)PropertyId.PidTagDisplayType;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[1] = tag;

            // PidTagAddressBookDisplayNamePrintable
            tag.PropertyId = (ushort)PropertyId.PidTagAddressBookDisplayNamePrintable;
            tag.PropertyType = (ushort)PropertyType.PtypString;
            sampleRecipientColumns[2] = tag;

            // PidTagSmtpAddress
            tag.PropertyId = (ushort)PropertyId.PidTagSmtpAddress;
            tag.PropertyType = (ushort)PropertyType.PtypString;
            sampleRecipientColumns[3] = tag;

            // PidTagSendInternetEncoding
            tag.PropertyId = (ushort)PropertyId.PidTagSendInternetEncoding;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[4] = tag;

            // PidTagDisplayTypeEx
            tag.PropertyId = (ushort)PropertyId.PidTagDisplayTypeEx;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[5] = tag;

            // PidTagRecipientDisplayName
            tag.PropertyId = (ushort)PropertyId.PidTagRecipientDisplayName;
            tag.PropertyType = (ushort)PropertyType.PtypString;
            sampleRecipientColumns[6] = tag;

            // PidTagRecipientFlags
            tag.PropertyId = (ushort)PropertyId.PidTagRecipientFlags;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[7] = tag;

            // PidTagRecipientTrackStatus
            tag.PropertyId = (ushort)PropertyId.PidTagRecipientTrackStatus;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[8] = tag;

            // PidTagRecipientResourceState
            tag.PropertyId = (ushort)PropertyId.PidTagRecipientResourceState;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[9] = tag;

            // PidTagRecipientOrder
            tag.PropertyId = (ushort)PropertyId.PidTagRecipientOrder;
            tag.PropertyType = (ushort)PropertyType.PtypInteger32;
            sampleRecipientColumns[10] = tag;

            // PidTagRecipientEntryId
            tag.PropertyId = (ushort)PropertyId.PidTagRecipientEntryId;
            tag.PropertyType = (ushort)PropertyType.PtypBinary;
            sampleRecipientColumns[11] = tag;
            #endregion

            #region Configure a StandardPropertyRow: propertyRow
            PropertyValue[] propertyValueArray = new PropertyValue[12];
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValueArray[i] = new PropertyValue();
            }

            // PidTagObjectType
            propertyValueArray[0].Value = BitConverter.GetBytes(0x00000006);

            // PidTagDisplayType
            propertyValueArray[1].Value = BitConverter.GetBytes(0x00000000);

            // PidTagAddressBookDisplayNamePrintable
            propertyValueArray[2].Value = Encoding.Unicode.GetBytes(mailTo + "\0");

            // PidTagSmtpAddress
            propertyValueArray[3].Value = Encoding.Unicode.GetBytes(mailTo + "@" + this.Domain + "\0");

            // PidTagSendInternetEncoding
            propertyValueArray[4].Value = BitConverter.GetBytes(0x00000000);

            // PidTagDisplayTypeEx
            propertyValueArray[5].Value = BitConverter.GetBytes(0x40000000);

            // PidTagRecipientDisplayName
            propertyValueArray[6].Value = Encoding.Unicode.GetBytes(mailTo + "\0");

            // PidTagRecipientFlags
            propertyValueArray[7].Value = BitConverter.GetBytes(0x00000001);

            // PidTagRecipientTrackStatus
            propertyValueArray[8].Value = BitConverter.GetBytes(0x00000000);

            // PidTagRecipientResourceState
            propertyValueArray[9].Value = BitConverter.GetBytes(0x00000000);

            // PidTagRecipientOrder
            propertyValueArray[10].Value = BitConverter.GetBytes(0x00000000);

            AddressBookEntryID addressBookEntryID = new AddressBookEntryID(mailToUserDN);
            propertyValueArray[11].Value = Common.AddInt16LengthBeforeBinaryArray(addressBookEntryID.Serialize());

            List<PropertyValue> propertyValues = new List<PropertyValue>();
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValues.Add(propertyValueArray[i]);
            }

            PropertyRow propertyRow = new PropertyRow
            {
                Flag = 0x01,
                PropertyValues = propertyValues
            };
            #endregion

            RecipientRow recipientRow = new RecipientRow
            {
                RecipientFlags = 0x065B,
                DisplayName = Encoding.Unicode.GetBytes(mailTo + "\0"),
                EmailAddress = Encoding.Unicode.GetBytes(mailTo + "@" + this.Domain + "\0"),
                SimpleDisplayName = Encoding.Unicode.GetBytes(mailTo + "\0"),
                RecipientColumnCount = 0x000C,
                RecipientProperties = propertyRow
            };

            ModifyRecipientRow modifyRecipientRow = new ModifyRecipientRow
            {
                RowId = 0x00000000,
                RecipientType = 0x01,
                RecipientRowSize = (ushort)recipientRow.Size(),
                RecptRow = recipientRow.Serialize()
            };

            ModifyRecipientRow[] sampleModifyRecipientRows = new ModifyRecipientRow[1];
            sampleModifyRecipientRows[0] = modifyRecipientRow;
            this.OxoruleAdapter.RopModifyRecipients(msgHandle, sampleRecipientColumns, sampleModifyRecipientRows);
            this.OxoruleAdapter.RopSaveChangesMessage(msgHandle);
            RopSubmitMessageResponse submitMsgRes = this.OxoruleAdapter.RopSubmitMessage(msgHandle, 0);
            return submitMsgRes.ReturnValue;
        }
        /// <summary>
        /// Create Recipient Array 
        /// </summary>
        /// <param name="recipientColumns">Recipient Columns </param>
        /// <param name="recipientRows">Recipient Rows</param>
        private void CreateRecipientColumnsAndRecipientRows(out PropertyTag[] recipientColumns, out ModifyRecipientRow[] recipientRows)
        {
            #region recipientColumns

            // The following sample data is from MS-OXCMSG
            PropertyTag[] sampleRecipientColumns = new PropertyTag[12];
            PropertyTag tag;

            // PidTagObjectType
            tag.PropertyId = 0x0ffe;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[0] = tag;

            // PidTagDisplayType
            tag.PropertyId = 0x3900;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[1] = tag;

            // PidTagAddressBookDisplayNamePrintable
            tag.PropertyId = 0x39ff;
            tag.PropertyType = 0x001f; // PtypString
            sampleRecipientColumns[2] = tag;

            // PidTagSmtpAddress
            tag.PropertyId = 0x39fe;
            tag.PropertyType = 0x001f; // PtypString
            sampleRecipientColumns[3] = tag;

            // PidTagSendInternetEncoding
            tag.PropertyId = 0x3a71;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[4] = tag;

            // PidTagDisplayTypeEx
            tag.PropertyId = 0x3905;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[5] = tag;

            // PidTagRecipientDisplayName
            tag.PropertyId = 0x5ff6;
            tag.PropertyType = 0x001f; // PtypString
            sampleRecipientColumns[6] = tag;

            // PidTagRecipientFlags
            tag.PropertyId = 0x5ffd;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[7] = tag;

            // PidTagRecipientTrackStatus
            tag.PropertyId = 0x5fff;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[8] = tag;

            // PidTagRecipientResourceState
            tag.PropertyId = 0x5fde;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[9] = tag;

            // PidTagRecipientOrder
            tag.PropertyId = 0x5fdf;
            tag.PropertyType = 0x0003; // PtypInteger32
            sampleRecipientColumns[10] = tag;

            // PidTagRecipientEntryId
            tag.PropertyId = 0x5ff7;
            tag.PropertyType = 0x0102; // PtypBinary
            sampleRecipientColumns[11] = tag;

            recipientColumns = sampleRecipientColumns;
            #endregion

            #region Configure a StandardPropertyRow: propertyRow, data is from Page 62 of MS-OXCMSG

            PropertyValue[] propertyValueArray = new PropertyValue[12];
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValueArray[i] = new PropertyValue();
            }

            propertyValueArray[0].Value = BitConverter.GetBytes(0x00000006); // PidTagObjectType
            propertyValueArray[1].Value = BitConverter.GetBytes(0x00000000); // PidTagDisplayType
            propertyValueArray[2].Value = Encoding.Unicode.GetBytes(UserName + TestSuiteBase.NullTerminatorString); // PidTa7BitDisplayName
            string domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
            propertyValueArray[3].Value = Encoding.Unicode.GetBytes(UserName + TestSuiteBase.At + domainName + TestSuiteBase.NullTerminatorString); // PidTagSmtpAddress
            propertyValueArray[4].Value = BitConverter.GetBytes(0x00000000); // PidTagSendInternetEncoding
            propertyValueArray[5].Value = BitConverter.GetBytes(0x40000000); // PidTagDisplayTypeEx
            propertyValueArray[6].Value = Encoding.Unicode.GetBytes(UserName + TestSuiteBase.NullTerminatorString); // PidTagRecipientDisplayName
            propertyValueArray[7].Value = BitConverter.GetBytes(0x00000001); // PidTagRecipientFlags
            propertyValueArray[8].Value = BitConverter.GetBytes(0x00000000); // PidTagRecipientTrackStatus
            propertyValueArray[9].Value = BitConverter.GetBytes(0x00000000); // PidTagRecipientResourceState
            propertyValueArray[10].Value = BitConverter.GetBytes(0x00000000); // PidTagRecipientOrder

            // The following sample data (0x007c and the subsequent 124(0x7c) binary) 
            byte[] sampleData = 
            {
                0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xa7, 0x40,
                0xc8, 0xc0, 0x42, 0x10, 0x1a, 0xb4, 0xb9, 0x08, 0x00, 0x2b, 0x2f, 0xe1, 0x82, 0x01, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x6f, 0x3d, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x4f, 0x72,
                0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x75, 0x3d, 0x45, 0x78,
                0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72,
                0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x28, 0x46, 0x59, 0x44,
                0x49, 0x42, 0x4f, 0x48, 0x46, 0x32, 0x33, 0x53, 0x50, 0x44, 0x4c, 0x54, 0x29, 0x2f, 0x63, 0x6e,
                0x3d, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x63, 0x6e, 0x3d, 0x75,
                0x73, 0x65, 0x72, 0x32, 0x00
            };
            propertyValueArray[11].Value = sampleData; // PidTagRecipientEntryId

            List<PropertyValue> propertyValues = new List<PropertyValue>();
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValues.Add(propertyValueArray[i]);
            }

            PropertyRow propertyRow = new PropertyRow
            {
                Flag = 0x01, PropertyValues = propertyValues
            };
            #endregion

            RecipientRow recipientRow = new RecipientRow
            {
                RecipientFlags = 0x065B,
                DisplayName = Encoding.Unicode.GetBytes(UserName + TestSuiteBase.NullTerminatorString),
                EmailAddress = Encoding.Unicode.GetBytes(UserName + TestSuiteBase.At + domainName + TestSuiteBase.NullTerminatorString),
                SimpleDisplayName = Encoding.Unicode.GetBytes(UserName + TestSuiteBase.NullTerminatorString),
                RecipientColumnCount = 0x000C,
                RecipientProperties = propertyRow
            };

            ModifyRecipientRow modifyRecipientRow = new ModifyRecipientRow
            {
                RowId = 0x00000000,
                RecipientType = (byte)RecipientType.PrimaryRecipient,
                RecipientRowSize = (ushort)recipientRow.Size(),
                RecptRow = recipientRow.Serialize()
            };

            ModifyRecipientRow[] sampleModifyRecipientRows = new ModifyRecipientRow[3];
            sampleModifyRecipientRows[0] = modifyRecipientRow;

            // Test add second recipient 
            ModifyRecipientRow testmodifyRecipientRow = new ModifyRecipientRow
            {
                RowId = 0x0000001,
                RecipientType = (byte)RecipientType.PrimaryRecipient,
                RecipientRowSize = (ushort)recipientRow.Size(),
                RecptRow = recipientRow.Serialize()
            };
            sampleModifyRecipientRows[1] = testmodifyRecipientRow;

            ModifyRecipientRow test2modifyRecipientRow = new ModifyRecipientRow
            {
                RowId = 0x0000002,
                RecipientType = (byte)RecipientType.PrimaryRecipient,
                RecipientRowSize = (ushort)recipientRow.Size(),
                RecptRow = recipientRow.Serialize()
            };
            sampleModifyRecipientRows[2] = test2modifyRecipientRow;

            recipientRows = sampleModifyRecipientRows;
        }
        /// <summary>
        /// Create Recipient Array 
        /// </summary>
        /// <param name="name">Recipient name value</param>
        /// <param name="rowId">RowId value</param>
        /// <param name="recipientType">Recipient type value</param>
        /// <returns>Return ModifyRecipientRow</returns>
        protected ModifyRecipientRow CreateModifyRecipientRow(string name, uint rowId, RecipientType recipientType)
        {
            PropertyRow propertyRow = this.CreateRecipientColumns(name);

            RecipientRow recipientRow = new RecipientRow
            {
                RecipientFlags = 0x065B,
                DisplayName = Common.GetBytesFromUnicodeString(name)
            };
            string domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
            recipientRow.EmailAddress = Common.GetBytesFromUnicodeString(string.Format("{0}{1}{2}", name, TestSuiteBase.At, domainName));
            recipientRow.SimpleDisplayName = Common.GetBytesFromUnicodeString(PrefixOfDisplayName + name);
            recipientRow.RecipientColumnCount = 0x000C; // Matches ColummnCount
            recipientRow.RecipientProperties = propertyRow;

            ModifyRecipientRow modifyRecipientRow = new ModifyRecipientRow
            {
                RowId = rowId,
                RecipientType = (byte)recipientType,
                RecipientRowSize = (ushort)recipientRow.Size(),
                RecptRow = recipientRow.Serialize()
            };

            return modifyRecipientRow;
        }