コード例 #1
0
        /// <summary>
        /// Send message related Item elements on the server.
        /// </summary>
        /// <param name="request">Specify a request to send message objects.</param>
        /// /// <returns>The response message returned by SendItem operation.</returns>
        public SendItemResponseType SendItem(SendItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'SendItem' should not be null.");
            }

            SendItemResponseType response = this.exchangeServiceBinding.SendItem(request);

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifySendItemOperation(this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
コード例 #2
0
        /// <summary>
        /// Send messages and post items on the server.
        /// </summary>
        /// <param name="sendItemRequest">Specify a request to send items on the server.</param>
        /// <returns>A response to SendItem operation request.</returns>
        public SendItemResponseType SendItem(SendItemType sendItemRequest)
        {
            SendItemResponseType response = this.exchangeServiceBinding.SendItem(sendItemRequest);

            Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");

            // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported.
            this.VerifySoapVersion();

            // Verify transport type related requirement.
            this.VerifyTransportType();

            this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated);
            this.VerifySendItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
コード例 #3
0
        /// <summary>
        /// Asks Exchange to send a specific message.
        /// </summary>
        /// <param name="messageId"></param>
        public void SendMessage(ItemIdType messageId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            // Send message
            var sendItem = new SendItemType {
                ItemIds = new BaseItemIdType[1], SavedItemFolderId = new TargetFolderIdType()
            };
            var siSentItemsFolder = new DistinguishedFolderIdType {
                Id = DistinguishedFolderIdNameType.sentitems
            };

            sendItem.SavedItemFolderId.Item = siSentItemsFolder;
            sendItem.SaveItemToFolder       = true;
            sendItem.ItemIds[0]             = messageId;

            SendItemResponseType sendItemResponse = binding.SendItem(sendItem);

            if (sendItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(sendItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
コード例 #4
0
        /// <summary>
        /// Verify the SendItemResponseType structure in section 2.
        /// </summary>
        /// <param name="sendItemResponse">A SendItemResponseType instance.</param>
        private void VerifySendItemResponseTypeSchema(SendItemResponseType sendItemResponse)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R50");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R50
            // The schema is validated and the response of SendItem operation is not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                50,
                @"[In m:SendItemResponseType Complex Type] [The type SendItemResponseType is defined as follows:]
                     <xs:complexType name=""SendItemResponseType"">
                      <xs:complexContent>
                        <xs:extension
                          base=""m:BaseResponseMessageType""
                         />
                      </xs:complexContent>
                    </xs:complexType>");

            // Verify the BaseResponseMessageType schema.
            this.VerifyBaseResponseMessageType(sendItemResponse);
        }
コード例 #5
0
        /// <summary>
        /// Verify the SendItemResponseType structure.
        /// </summary>
        /// <param name="sendItemResponse">A SendItemResponseType instance.</param>
        /// <param name="isSchemaValidated">Indicate whether schema is verified.</param>
        private void VerifySendItemResponse(SendItemResponseType sendItemResponse, bool isSchemaValidated)
        {
            Site.Assert.IsTrue(isSchemaValidated, "The schema should be validated.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R425
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                425,
                @"[In SendItem Operation] The following is the WSDL port type specification for the SendItem operation: 
                    <wsdl:operation name=""SendItem"">
                       <wsdl:input message=""tns:SendItemSoapIn"" />
                       <wsdl:output message=""tns:SendItemSoapOut"" />
                    </wsdl:operation>");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R426
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                426,
                @"[In SendItem Operation] The following is the WSDL binding specification for the SendItem operation:
                    <wsdl:operation name=""SendItem"">
                       <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/SendItem"" />
                       <wsdl:input>
                          <soap:header message=""tns:SendItemSoapIn"" part=""Impersonation"" use=""literal""/>
                          <soap:header message=""tns:SendItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
                          <soap:header message=""tns:SendItemSoapIn"" part=""RequestVersion"" use=""literal""/>
                          <soap:body parts=""request"" use=""literal"" />
                       </wsdl:input>
                       <wsdl:output>
                          <soap:body parts=""SendItemResult"" use=""literal"" />
                          <soap:header message=""tns:SendItemSoapOut"" part=""ServerVersion"" use=""literal""/>
                       </wsdl:output>
                    </wsdl:operation>");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R440
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                440,
                @"[In tns:SendItemSoapOut Message] [The SendItemSoapOut WSDL message is defined as:]
                    <wsdl:message name=""SendItemSoapOut"">
                       <wsdl:part name=""SendItemResult"" element=""tns:SendItemResponse"" />
                       <wsdl:part name=""ServerVersion"" element=""t:ServerVersionInfo""/>
                    </wsdl:message>");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1454
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                1454,
                @"[In tns:SendItemSoapOut Message] The type of SendItemResult is tns:SendItemResponse (section 3.1.4.8.2.2).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R443
            // According to the schema, sendItemResponse is the SOAP body of a response message returned by server, 
            // this requirement can be verified directly.
            Site.CaptureRequirement(
                443,
                @"[In tns:SendItemSoapOut Message] [The part ""SendItemResult""] Specifies the SOAP body of a response message.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1455
            Site.CaptureRequirementIfIsNotNull(
                this.exchangeServiceBinding.ServerVersionInfoValue,
                1455,
                @"[In tns:SendItemSoapOut Message] The type of ServerVersion is t:ServerVersionInfo ([MS-OXWSCDATA] section 2.2.5.10).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R444
            // According to the schema, ServerVersion is the SOAP header that contains the server version information, 
            // this requirement can be verified directly.
            Site.CaptureRequirement(
                444,
                @"[In tns:SendItemSoapOut Message] [The part ""ServerVersion""] Specifies a SOAP header that identifies the server version for the response to a SendItem operation request.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R451
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                451,
                @"[In m:SendItemResponse Element] [The SendItemResponse element is defined as:]
                    <xs:element name=""SendItemResponse""
                      type=""m:SendItemResponseType""
                     />");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R457
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                457,
                @"[In m:SendItemResponseType Complex Type] [The SendItemResponseType complex type is defined as:]
                    <xs:complexType name=""SendItemResponseType"">
                      <xs:complexContent>
                        <xs:extension
                          base=""m:BaseResponseMessageType""
                         />
                      </xs:complexContent>
                    </xs:complexType>");

            // Verify the BaseResponseMessageType schema.
            this.VerifyBaseResponseMessageType(sendItemResponse);

            foreach (ResponseMessageType message in sendItemResponse.ResponseMessages.Items)
            {
                this.VerifyResponseMessageType(message);
            }

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R450
            // This requirement can be captured directly, since SendItemResponse is the response of a SendItem operation request.
            Site.CaptureRequirement(
                450,
                @"[In m:SendItemResponse Element] The SendItemResponse element specifies a response to a SendItem operation request.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R447
            // This requirement can be captured directly, since SendItemResponse is the response of a SendItem operation request.
            Site.CaptureRequirement(
                447,
                @"[In Elements] [The element ""SentItemResponse""] Specifies a response to a SendItem operation request.");

            this.VerifySendItemResponseTypeSchema(sendItemResponse);
        }
コード例 #6
0
        public void MSOXWSMSG_S05_TC01_SendMessage()
        {
            #region Create the message
            CreateItemType         createItemRequest  = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts);
            CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest);
            Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);

            // Save the ItemId of message responseMessageItem got from the createItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            ItemIdType itemIdType = new ItemIdType();
            itemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;
            #endregion

            #region Send the message
            SendItemType sendItemRequest = new SendItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                SaveItemToFolder = true,

                // Save the message copy in sent items folder.
                SavedItemFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.sentitems
                    }
                }
            };

            SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(sendItemResponse), @"Server should return success for sending the email messages.");
            Site.Assert.IsNotNull(sendItemResponse.ResponseMessages.Items, @"Items in the returned response should not be null.");

            #region Verify the requirements about SendItem
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R177");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R177
            Site.CaptureRequirementIfIsNotNull(
                sendItemResponse,
                177,
                @"[In SendItem] The protocol client sends a SendItemSoapIn request WSDL message, and the protocol server responds with a SendItemSoapOut response WSDL message.");

            Site.Assert.IsNotNull(sendItemResponse.ResponseMessages.Items[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null.");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R178
            Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                sendItemResponse.ResponseMessages.Items[0].ResponseClass,
                178,
                @"[In SendItem] A successful SendItem operation request returns a SendItemResponse element with the ResponseClass attribute of the SendItemResponseMessage element set to ""Success"".");

            Site.Assert.IsNotNull(sendItemResponse.ResponseMessages.Items[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null.");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R179
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.NoError,
                sendItemResponse.ResponseMessages.Items[0].ResponseCode,
                179,
                @"[In SendItem] [A successful SendItem operation request returns a SendItemResponse element] The ResponseCode element of the SendItemResponse element is set to ""NoError"".");
            #endregion
            #endregion

            #region Create the invalid message for SendItem operation without ToRecipients element
            CreateItemType createItemRequestFailed = new CreateItemType
            {
                MessageDisposition = MessageDispositionType.SaveOnly,

                // MessageDispositionSpecified value needs to be set.
                MessageDispositionSpecified = true,

                SavedItemFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.drafts
                    }
                },

                Items = new NonEmptyArrayOfAllItemsType
                {
                    Items = new MessageType[]
                    {
                        new MessageType
                        {
                            Sender = new SingleRecipientType
                            {
                                Item = new EmailAddressType
                                {
                                    EmailAddress = this.Sender
                                }
                            },
                            Subject = this.Subject,
                        }
                    }
                },
            };

            CreateItemResponseType createItemResponseFailed = this.MSGAdapter.CreateItem(createItemRequestFailed);
            Site.Assert.IsTrue(this.VerifyResponse(createItemResponseFailed), @"Server should return success for creating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponseFailed);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of message responseMessageItem got from the createItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            itemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;
            #endregion

            #region Send the message without ToRecipients element
            SendItemType sendItemRequestFailed = new SendItemType
            {
                // Set to invalid message's ItemId.
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                SaveItemToFolder  = true,
                SavedItemFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.sentitems
                    }
                }
            };

            SendItemResponseType sendItemResponseFailed = this.MSGAdapter.SendItem(sendItemRequestFailed);

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R31
            Site.CaptureRequirementIfAreNotEqual <ResponseClassType>(
                ResponseClassType.Success,
                sendItemResponseFailed.ResponseMessages.Items[0].ResponseClass,
                31,
                @"[In t:MessageType Complex Type] [ToRecipients element] This element is required for sending a message.");
            #endregion

            #region Delete the invalid message
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                // Set to invalid message's ItemId.
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion

            #region Clean up Sender's sentitems folder and Recipient1's inbox folder
            bool isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Sender", this.Site),
                Common.GetConfigurationPropertyValue("SenderPassword", this.Site),
                this.Domain,
                this.Subject,
                "sentitems");
            Site.Assert.IsTrue(isClear, "Sender's sentitems folder should be cleaned up.");

            isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Recipient1", this.Site),
                Common.GetConfigurationPropertyValue("Recipient1Password", this.Site),
                this.Domain,
                this.Subject,
                "inbox");
            Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up.");
            #endregion
        }
コード例 #7
0
        public void MSOXWSMSG_S06_TC01_OperateMultipleMessages()
        {
            #region Create multiple message
            string subject        = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 0);
            string anotherSubject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 1);

            CreateItemType createItemRequest = new CreateItemType
            {
                MessageDisposition = MessageDispositionType.SaveOnly,

                // MessageDispositionSpecified value needs to be set.
                MessageDispositionSpecified = true,

                SavedItemFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.drafts
                    }
                },

                Items = new NonEmptyArrayOfAllItemsType
                {
                    // Create an responseMessageItem with two MessageType instances.
                    Items = new MessageType[]
                    {
                        new MessageType
                        {
                            Sender = new SingleRecipientType
                            {
                                Item = new EmailAddressType
                                {
                                    EmailAddress = this.Sender
                                }
                            },

                            ToRecipients = new EmailAddressType[]
                            {
                                new EmailAddressType
                                {
                                    EmailAddress = this.Recipient1
                                }
                            },

                            Subject = subject,
                        },

                        new MessageType
                        {
                            Sender = new SingleRecipientType
                            {
                                Item = new EmailAddressType
                                {
                                    EmailAddress = this.Sender
                                }
                            },

                            ToRecipients = new EmailAddressType[]
                            {
                                new EmailAddressType
                                {
                                    EmailAddress = this.Recipient2
                                }
                            },

                            Subject = anotherSubject,
                        }
                    }
                },
            };

            CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(createItemResponse), @"Server should return success for creating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the first ItemId of message responseMessageItem got from the createItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            ItemIdType itemIdType1 = new ItemIdType();
            itemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the second ItemId.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            ItemIdType itemIdType2 = new ItemIdType();
            itemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Get the multiple messages which created
            GetItemType getItemRequest = new GetItemType
            {
                // Set the two ItemIds got from CreateItem response.
                ItemIds = new ItemIdType[]
                {
                    itemIdType1,
                    itemIdType2
                },

                ItemShape = new ItemResponseShapeType
                {
                    BaseShape = DefaultShapeNamesType.AllProperties,
                }
            };

            GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(getItemResponse), @"Server should return success for creating the email messages.");
            #endregion

            #region Update the multiple messages which created
            UpdateItemType updateItemRequest = new UpdateItemType
            {
                MessageDisposition = MessageDispositionType.SaveOnly,

                // MessageDispositionSpecified value needs to be set.
                MessageDispositionSpecified = true,

                // Create two ItemChangeType instances.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType
                    {
                        Item = itemIdType1,

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType
                            {
                                Item = new PathToUnindexedFieldType
                                {
                                    FieldURI = UnindexedFieldURIType.messageToRecipients
                                },

                                // Update ToRecipients property of the first message.
                                Item1 = new MessageType
                                {
                                    ToRecipients = new EmailAddressType[]
                                    {
                                        new EmailAddressType
                                        {
                                            EmailAddress = this.Recipient2
                                        }
                                    }
                                }
                            },
                        }
                    },

                    new ItemChangeType
                    {
                        Item = itemIdType2,

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType
                            {
                                Item = new PathToUnindexedFieldType
                                {
                                    FieldURI = UnindexedFieldURIType.messageToRecipients
                                },

                                // Update ToRecipients property of the second message.
                                Item1 = new MessageType
                                {
                                    ToRecipients = new EmailAddressType[]
                                    {
                                        new EmailAddressType
                                        {
                                            EmailAddress = this.Recipient1
                                        }
                                    }
                                }
                            },
                        }
                    }
                }
            };

            UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(updateItemResponse), @"Server should return success for updating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(updateItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of the first message responseMessageItem got from the UpdateItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            itemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the ItemId of the second message responseMessageItem got from the UpdateItem response.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            itemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Copy the updated multiple message to junkemail
            CopyItemType copyItemRequest = new CopyItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType1,
                    itemIdType2,
                },

                // Copy the message to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(copyItemResponse), @"Server should return success for copying the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of the first message responseMessageItem got from the CopyItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            ItemIdType copyItemIdType1 = new ItemIdType();
            copyItemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the ItemId of the second message responseMessageItem got from the CopyItem response.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            ItemIdType copyItemIdType2 = new ItemIdType();
            copyItemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Move the copied multiple message from junkemail to deleteditems
            MoveItemType moveItemRequest = new MoveItemType
            {
                // Set to copied message responseMessageItem id.
                ItemIds = new ItemIdType[]
                {
                    copyItemIdType1,
                    copyItemIdType2
                },

                // Move the copied messages to deleted items folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.deleteditems
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(moveItemResponse), @"Server should return success for moving the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of the first message responseMessageItem got from the MoveItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            copyItemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the ItemId of the second message responseMessageItem got from the MoveItem response.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            copyItemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Send multiple messages
            SendItemType sendItemRequest = new SendItemType
            {
                // Set to the two updated messages' ItemIds.
                ItemIds = new ItemIdType[]
                {
                    itemIdType1,
                    itemIdType2
                },

                // Do not save copy.
                SaveItemToFolder = false,
            };

            SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(sendItemResponse), @"Server should return success for sending the email messages.");
            #endregion

            #region Delete the copied messages
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                // Set to the two copied messages' ItemIds.
                ItemIds = new ItemIdType[]
                {
                    copyItemIdType1,
                    copyItemIdType2
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion

            #region Clean up Recipient1's and Recipient2's inbox folders
            bool isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Recipient2", this.Site),
                Common.GetConfigurationPropertyValue("Recipient2Password", this.Site),
                this.Domain,
                subject,
                "inbox");
            Site.Assert.IsTrue(isClear, "Recipient2's inbox folder should be cleaned up.");

            isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Recipient1", this.Site),
                Common.GetConfigurationPropertyValue("Recipient1Password", this.Site),
                this.Domain,
                anotherSubject,
                "inbox");
            Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up.");
            #endregion
        }