Exemplo n.º 1
0
        /// <summary>
        /// Move tasks on the server according to items' id.
        /// </summary>
        /// <param name="itemIds">The item id of tasks which will be moved.</param>
        /// <returns>The extracted items id array.</returns>
        protected ItemIdType[] MoveTasks(params ItemIdType[] itemIds)
        {
            // Define the MoveItem request.
            MoveItemType moveItemRequest = TestSuiteHelper.GenerateMoveItemRequest(itemIds);

            // Call the MoveItem method to move the task items created in previous steps.
            MoveItemResponseType moveItemResponse = this.TASKAdapter.MoveItem(moveItemRequest);

            this.VerifyResponseMessage(moveItemResponse);

            // Save the ItemId of task item got from the MoveItem response.
            return(Common.GetItemIdsFromInfoResponse(moveItemResponse));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Move contact item on the server.
        /// </summary>
        /// <param name="moveItemRequest">The request of MoveItem operation.</param>
        /// <returns>A response to MoveItem operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType moveItemResoponse = this.exchangeServiceBinding.MoveItem(moveItemRequest);

            #region Verify MoveItem operation requirements

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyMoveContactItem(this.exchangeServiceBinding.IsSchemaValidated);
            #endregion

            return(moveItemResoponse);
        }
        /// <summary>
        /// Move items on the server.
        /// </summary>
        /// <param name="moveItemRequest">Specify a request to move items on the server.</param>
        /// <returns>A response to MoveItem operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType response = this.exchangeServiceBinding.MoveItem(moveItemRequest);

            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.VerifyMoveItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Move the calendar related item elements.
        /// </summary>
        /// <param name="request">A request to the MoveItem operation.</param>
        /// <returns>The response message returned by MoveItem operation.</returns>
        public MoveItemResponseType MoveItem(MoveItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'MoveItem' should not be null.");
            }

            MoveItemResponseType moveItemResponse = this.exchangeServiceBinding.MoveItem(request);

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

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyMoveItemOperation(moveItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            return(moveItemResponse);
        }
        /// <summary>
        /// Moves Task items on the server.
        /// </summary>
        /// <param name="moveItemRequest">Specifies a request to move Task items on the server.</param>
        /// <returns>A response to this operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType moveItemResponse = this.exchangeServiceBinding.MoveItem(moveItemRequest);

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

            // Verify the move item operation.
            this.VerifyMoveItemOperation(moveItemResponse, this.exchangeServiceBinding.IsSchemaValidated);

            // Verify Soap version requirements.
            this.VerifySoapVersion();

            // Verify transport requirements.
            this.VerifyTransportType();

            return(moveItemResponse);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Moves the given message to the given folder.
        /// </summary>
        public void MoveMessageToFolder(ItemIdType messageId, string folderId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var request = new MoveItemType
            {
                ItemIds    = new BaseItemIdType[] { messageId },
                ToFolderId = new TargetFolderIdType {
                    Item = new FolderIdType {
                        Id = folderId
                    }
                }
            };

            MoveItemResponseType moveItemResponse = binding.MoveItem(request);

            if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
        public void MSOXWSCORE_S01_TC22_ReturnNewItemIdsIsIgnored()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(1230, this.Site), "Exchange 2007 does not support the ReturnNewItemIds element.");

            #region Step 1: Create the item.
            ItemType item = new ItemType();
            ItemIdType[] createdItemIdsForReturnNewItemIdsValueTrue = this.CreateItemWithMinimumElements(item);
            ItemIdType[] createdItemIdsForReturnNewItemIdsValueFalse = this.CreateItemWithMinimumElements(item);
            ItemIdType[] createdItemIdsForNoReturnNewItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2: Copy the item with ReturnNewItemIds element setting to true.
            CopyItemType copyItemRequest = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();
            copyItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueTrue;
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem;
            copyItemRequest.ReturnNewItemIds = true;
            copyItemRequest.ReturnNewItemIdsSpecified = true;
            copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest);
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            ItemIdType[] copiedItemIdsWithReturnNewItemIdsValueTrue = Common.GetItemIdsFromInfoResponse(copyItemResponse);
            Site.Assert.AreEqual<int>(
                 1,
                 copiedItemIdsWithReturnNewItemIdsValueTrue.GetLength(0),
                 "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 copiedItemIdsWithReturnNewItemIdsValueTrue.GetLength(0));
            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            bool isReturnNewIdsForReturnNewItemIdsTrue = !copiedItemIdsWithReturnNewItemIdsValueTrue[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase)
                || !copiedItemIdsWithReturnNewItemIdsValueTrue[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].Id, StringComparison.InvariantCultureIgnoreCase);
            #endregion

            #region Step 3: Copy the item with ReturnNewItemIds element setting to false.
            copyItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueFalse;
            copyItemRequest.ReturnNewItemIds = false;
            copyItemRequest.ReturnNewItemIdsSpecified = true;
            copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest);
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            ItemIdType[] copiedItemIdsWithReturnNewItemIdsValueFalse = Common.GetItemIdsFromInfoResponse(copyItemResponse);
            Site.Assert.AreEqual<int>(
                 1,
                 copiedItemIdsWithReturnNewItemIdsValueFalse.GetLength(0),
                 "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 copiedItemIdsWithReturnNewItemIdsValueFalse.GetLength(0));
            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            bool isReturnNewIdsForReturnNewItemIdsFalse = !copiedItemIdsWithReturnNewItemIdsValueFalse[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase)
                || !copiedItemIdsWithReturnNewItemIdsValueFalse[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].Id, StringComparison.InvariantCultureIgnoreCase);
            #endregion

            #region Step 4: Copy the item without ReturnNewItemIds element.
            copyItemRequest.ItemIds = createdItemIdsForNoReturnNewItemIds;
            copyItemRequest.ReturnNewItemIdsSpecified = false;
            copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest);
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            ItemIdType[] copiedItemIdsWithoutReturnNewItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse);
            Site.Assert.AreEqual<int>(
                 1,
                 copiedItemIdsWithoutReturnNewItemIds.GetLength(0),
                 "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 copiedItemIdsWithoutReturnNewItemIds.GetLength(0));
            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            bool isReturnNewIdsForNoReturnNewItemIds = !copiedItemIdsWithoutReturnNewItemIds[0].ChangeKey.Equals(createdItemIdsForNoReturnNewItemIds[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase)
                || !copiedItemIdsWithoutReturnNewItemIds[0].Id.Equals(createdItemIdsForNoReturnNewItemIds[0].Id, StringComparison.InvariantCultureIgnoreCase);

            Site.Assert.IsTrue(
                isReturnNewIdsForReturnNewItemIdsTrue == isReturnNewIdsForReturnNewItemIdsFalse
                && isReturnNewIdsForReturnNewItemIdsFalse == isReturnNewIdsForNoReturnNewItemIds,
                "New item id should be always returned or not for CopyItem regardless of wheter including ReturnNewItemIds element and the value for it.");
            #endregion

            #region Step 5: Move the item with ReturnNewItemIds element setting to true.
            createdItemIdsForReturnNewItemIdsValueTrue = this.CreateItemWithMinimumElements(item);
            createdItemIdsForReturnNewItemIdsValueFalse = this.CreateItemWithMinimumElements(item);
            createdItemIdsForNoReturnNewItemIds = this.CreateItemWithMinimumElements(item);

            MoveItemType moveItemRequest = new MoveItemType();
            moveItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueTrue;
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id = DistinguishedFolderIdNameType.inbox;
            moveItemRequest.ToFolderId = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;
            moveItemRequest.ReturnNewItemIds = true;
            moveItemRequest.ReturnNewItemIdsSpecified = true;
            MoveItemResponseType moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest);
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            ItemIdType[] movedItemIdsForReturnNewItemIdsValueTrue = Common.GetItemIdsFromInfoResponse(moveItemResponse);
            Site.Assert.AreEqual<int>(
                 1,
                 movedItemIdsForReturnNewItemIdsValueTrue.GetLength(0),
                 "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 movedItemIdsForReturnNewItemIdsValueTrue.GetLength(0));
            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");
            this.ExistItemIds.Remove(createdItemIdsForReturnNewItemIdsValueTrue[0]);

            isReturnNewIdsForReturnNewItemIdsTrue = !movedItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase)
                || !movedItemIdsForReturnNewItemIdsValueTrue[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].Id, StringComparison.InvariantCultureIgnoreCase);
            #endregion

            #region Step 6: Move the item with ReturnNewItemIds element setting to false.
            moveItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueFalse;
            moveItemRequest.ReturnNewItemIds = false;
            moveItemRequest.ReturnNewItemIdsSpecified = true;
            moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest);
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            ItemIdType[] movedItemIdsForReturnNewItemIdsValueFalse = Common.GetItemIdsFromInfoResponse(moveItemResponse);
            Site.Assert.AreEqual<int>(
                 1,
                 movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0),
                 "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0));
            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");
            this.ExistItemIds.Remove(createdItemIdsForReturnNewItemIdsValueFalse[0]);

            isReturnNewIdsForReturnNewItemIdsFalse = !movedItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase)
                || !movedItemIdsForReturnNewItemIdsValueFalse[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].Id, StringComparison.InvariantCultureIgnoreCase);
            #endregion

            #region Step 7: Move the item without ReturnNewItemIds element.
            moveItemRequest.ItemIds = createdItemIdsForNoReturnNewItemIds;
            moveItemRequest.ReturnNewItemIdsSpecified = false;
            moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest);
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            ItemIdType[] movedItemIdsForNoReturnNewItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse);
            Site.Assert.AreEqual<int>(
                 1,
                 movedItemIdsForNoReturnNewItemIds.GetLength(0),
                 "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0));
            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");
            this.ExistItemIds.Remove(createdItemIdsForNoReturnNewItemIds[0]);

            isReturnNewIdsForNoReturnNewItemIds = !movedItemIdsForNoReturnNewItemIds[0].ChangeKey.Equals(createdItemIdsForNoReturnNewItemIds[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase)
                || !movedItemIdsForNoReturnNewItemIds[0].Id.Equals(createdItemIdsForNoReturnNewItemIds[0].Id, StringComparison.InvariantCultureIgnoreCase);

            Site.Assert.IsTrue(
                isReturnNewIdsForReturnNewItemIdsTrue == isReturnNewIdsForReturnNewItemIdsFalse
                && isReturnNewIdsForReturnNewItemIdsFalse == isReturnNewIdsForNoReturnNewItemIds,
                "New item id should be always returned or not for MoveItem regardless of wheter including ReturnNewItemIds element and the value for it.");

            if (Common.IsRequirementEnabled(1230, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1230");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1230
                // The ReturnNewItemId was set in the MoveItem and CopyItem request and the operations was executed successfully as above, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    1230,
                    @"[In Appendix C: Product Behavior] Implementation does introduce the ReturnNewItemIds element. (<45> Section 2.2.4.16: The ReturnNewItemIds element was introduced in Microsoft Exchange Server 2010 Service Pack 1 (SP1) (Exchange 2010 SP1 and above follow this behavior).)");

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

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R47
                // ReturnNewItemIds is ignored by server, this requirement can be covered.
                this.Site.CaptureRequirement(
                    47,
                    @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ReturnNewItemIds""] Specifies a Boolean return value that indicates whether the ItemId element is to be returned for new items.");
            }
            #endregion
        }
        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
        }
Exemplo n.º 9
0
		/// <remarks/>
		public void MoveItemAsync(MoveItemType MoveItem1, object userState)
		{
			if ((MoveItemOperationCompleted == null))
			{
				MoveItemOperationCompleted = new SendOrPostCallback(OnMoveItemOperationCompleted);
			}
			InvokeAsync("MoveItem", new object[]
			                        	{
			                        		MoveItem1
			                        	}, MoveItemOperationCompleted, userState);
		}
        public void MSOXWSMTGS_S04_TC04_MoveItemErrorCalendarCannotMoveOrCopyOccurrence()
        {
            #region Define a recurring calendar item
            DateTime startTime = DateTime.Now;

            DailyRecurrencePatternType pattern = new DailyRecurrencePatternType();
            pattern.Interval = this.PatternInterval;

            NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
            range.NumberOfOccurrences = this.NumberOfOccurrences;
            range.StartDate = startTime;

            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID = Guid.NewGuid().ToString();
            calendarItem.Subject = this.Subject;
            calendarItem.Start = startTime;
            calendarItem.StartSpecified = true;
            calendarItem.End = startTime.AddHours(this.TimeInterval);
            calendarItem.EndSpecified = true;
            calendarItem.Recurrence = new RecurrenceType();
            calendarItem.Recurrence.Item = pattern;
            calendarItem.Recurrence.Item1 = range;
            #endregion

            #region Create the recurring calendar item and extract the Id of an occurrence item
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);

            OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType();
            occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey;
            occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id;
            occurrenceItemId.InstanceIndex = this.InstanceIndex;
            #endregion

            #region Copy one occurrence of the recurring calendar item
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.drafts;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            MoveItemType moveItemRequest = new MoveItemType();
            moveItemRequest.ItemIds = new BaseItemIdType[] { occurrenceItemId };
            moveItemRequest.ToFolderId = targetFolderId;
            MoveItemResponseType response = this.MTGSAdapter.MoveItem(moveItemRequest);

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1228
            Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Error,
                response.ResponseMessages.Items[0].ResponseClass,
                1228,
                @"[In Messages] If the request is unsuccessful, the MoveItem operation returns a MoveItemResponse element with the ResponseClass attribute of the MoveItemResponseMessage element set to ""Error"". ");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1231
            Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorCalendarCannotMoveOrCopyOccurrence,
                response.ResponseMessages.Items[0].ResponseCode,
                1231,
                @"[In Messages] ErrorCalendarCannotMoveOrCopyOccurrence: Specifies that an attempt was made to move or copy an occurrence of a recurring calendar item.");
            #endregion

            #region Clean up organizer's calendar folders.
            this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar });
            #endregion
        }
        public void MSOXWSCORE_S01_TC03_MoveItemSuccessfully()
        {
            #region Step 1: Create the item.
            ItemType item = new ItemType();
            ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2: Move the item.

            MoveItemType moveItemRequest = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds = createdItemIds;

            // Clear ExistItemIds for MoveItem.
            this.InitializeCollection();

            // Configure moving item to inbox folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id = DistinguishedFolderIdNameType.inbox;
            moveItemRequest.ToFolderId = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;
            moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest);

            // Check the operation response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);

            ItemIdType[] movedItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse);

            // One moved item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 movedItemIds.GetLength(0),
                 "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 movedItemIds.GetLength(0));

            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R419
            // The schema is validated and the response is not null, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                419,
                @"[In m:MoveItemResponseType Complex Type] The MoveItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R46
            // If the schema is validated, this requirement can be captured.
            this.Site.CaptureRequirement(
                46,
                @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ItemIds""] Specifies an array of elements of type BaseItemIdType that specifies a set of items to be moved.");

            ItemInfoResponseMessageType moveItemResponseMessage = moveItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1601
            // The schema is validated and the response is not null, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                moveItemResponseMessage,
                "MS-OXWSCDATA",
                1601,
                @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MoveItemResponseMessage"" is ""m:ItemInfoResponseMessageType"" type (section 2.2.4.37).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1056
            // The schema is validated and the response is not null, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                moveItemResponseMessage,
                "MS-OXWSCDATA",
                1056,
                @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MoveItemResponseMessage"" with type ""m:ItemInfoResponseMessageType(section 2.2.4.37)"" specifies the response message for the MoveItem operation ([MS-OXWSCORE] section 3.1.4.7).");
            #endregion

            #region Step 3: Get the created item failed.
            // Call the GetItem operation.
            GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual<int>(
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0),
                 "Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual<ResponseClassType>(
                ResponseClassType.Error,
                getItemResponse.ResponseMessages.Items[0].ResponseClass,
                string.Format(
                    "Get item operation should be failed with error! Actual response code: {0}",
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion

            #region Step 4: Get the moved item.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(movedItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 getItemIds.GetLength(0),
                 "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemIds.GetLength(0));

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R45
            // If the moved item was got successfully, R45 can be captured.
            this.Site.CaptureRequirement(
                45,
                @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ToFolderId""] Specifies an instance of the TargetFolderIdType complex type that specifies the folder to which the items specified by the ItemIds property are to be moved.");
            #endregion
        }
        /// <summary>
        /// Move contact item on the server.
        /// </summary>
        /// <param name="moveItemRequest">The request of MoveItem operation.</param>
        /// <returns>A response to MoveItem operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType moveItemResoponse = this.exchangeServiceBinding.MoveItem(moveItemRequest);

            #region Verify MoveItem operation requirements

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyMoveContactItem(this.exchangeServiceBinding.IsSchemaValidated);
            #endregion

            return moveItemResoponse;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Moves the given message to the given folder.
        /// </summary>
        public void MoveMessageToFolder(ItemIdType messageId, string folderId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var request = new MoveItemType
                {
                    ItemIds = new BaseItemIdType[] { messageId },
                    ToFolderId = new TargetFolderIdType { Item = new FolderIdType { Id = folderId } }
                };

            MoveItemResponseType moveItemResponse = binding.MoveItem(request);

            if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
                throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText);
        }
Exemplo n.º 14
0
 /// <remarks/>
 public void MoveItemAsync(MoveItemType MoveItem1)
 {
     this.MoveItemAsync(MoveItem1, null);
 }
Exemplo n.º 15
0
        public void MSOXWSMSG_S04_TC02_MoveMessageUnsuccessful()
        {
            #region Create 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.
            ItemIdType itemIdType = new ItemIdType();
            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 Delete the message created
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                ItemIds = new ItemIdType[]
                {
                    this.firstItemOfFirstInfoItem.ItemId
                }
            };

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

            #region Move message
            MoveItemType moveItemRequest = new MoveItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                // Set target folder to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);

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

            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Error,
                moveItemResponse.ResponseMessages.Items[0].ResponseClass,
                163001,
                @"[In MoveItem] If the MoveItem WSDL operation request is not successful, it returns a MoveItemResponse element with the ResponseClass attribute of the MoveItemResponseMessage element set to ""Error"". ");

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

            this.Site.CaptureRequirementIfIsTrue(
                System.Enum.IsDefined(typeof(ResponseCodeType), moveItemResponse.ResponseMessages.Items[0].ResponseCode),
                163002,
                @"[In MoveItem] [A unsuccessful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element of the MoveItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24.");

            #endregion
        }
        /// <summary>
        /// Move items on the server.
        /// </summary>
        /// <param name="moveItemRequest">Specify a request to move items on the server.</param>
        /// <returns>A response to MoveItem operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType response = this.exchangeServiceBinding.MoveItem(moveItemRequest);
            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.VerifyMoveItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return response;
        }
        public void MSOXWSCONT_S04_TC01_MoveContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            #endregion

            #region Step 2:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the moved contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the original contact item Id.
            // Call GetItem operation.
            getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual <int>(
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorItemNotFound,
                getItemResponse.ResponseMessages.Items[0].ResponseCode,
                string.Format(
                    "Get contact item with original item Id should fail! Expected response code: {0}, actual response code: {1}",
                    ResponseCodeType.ErrorItemNotFound,
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion
        }
Exemplo n.º 18
0
        public void MSOXWSCONT_S05_TC01_OperateMultipleContactItems()
        {
            #region Step 1:Create the contact item.
            CreateItemType createItemRequest = new CreateItemType();

            #region Config the contact items
            createItemRequest.Items       = new NonEmptyArrayOfAllItemsType();
            createItemRequest.Items.Items = new ContactItemType[2];

            // Create the first contact item.
            createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties();

            // Create the second contact item.
            createItemRequest.Items.Items[1] = this.BuildContactItemWithRequiredProperties();

            // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder.
            createItemRequest.SavedItemFolderId = new TargetFolderIdType()
            {
                Item = new DistinguishedFolderIdType()
                {
                    Id = DistinguishedFolderIdNameType.contacts,
                }
            };
            #endregion

            CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 2, this.Site);
            #endregion

            #region Step 2:Update the contact items.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    },
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[1],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastCommaFirst.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 2, this.Site);
            #endregion

            #region Step 3:Move the contact items.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[2];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];
            moveItemRequest.ItemIds[1] = this.ExistContactItems[1];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 2, this.Site);
            #endregion

            #region Step 4:Get the contact items.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 2, this.Site);
            #endregion

            #region Step 5:Copy the contact items.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[2];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];
            copyItemRequest.ItemIds[1] = this.ExistContactItems[1];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 2, this.Site);
            #endregion
        }
        public void MSOXWSMSG_S04_TC01_MoveMessage()
        {
            #region Create 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.
            ItemIdType itemIdType = new ItemIdType();
            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 Move message
            MoveItemType moveItemRequest = new MoveItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                // Set target folder to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(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 message responseMessageItem got from the moveItem response.
            ItemIdType moveItemIdType = new ItemIdType();
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            moveItemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id;
            moveItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Verify whether the message is moved to junkemail folder.
            string userName = Common.GetConfigurationPropertyValue("Sender", this.Site);
            string password = Common.GetConfigurationPropertyValue("SenderPassword", this.Site);
            string domain = Common.GetConfigurationPropertyValue("Domain", this.Site);
            bool findItemInDrafts = this.IsItemAvailableAfterMoveOrDelete(userName, password, domain, "drafts", this.Subject, "itemSubject");
            Site.Assert.IsFalse(findItemInDrafts, "The item should not be found in the drafts folder of Sender.");
            
            bool findItemInJunkemail = this.SearchItems(Role.Sender, "junkemail", this.Subject, "itemSubject");
            Site.Assert.IsTrue(findItemInJunkemail, "The item should be found in the junkemail folder of Sender.");

            #region Verify the requirements about MoveItem
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R161");
        
            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R161            
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                161,
                @"[In MoveItem] The protocol client sends a MoveItemSoapIn request WSDL message, and the protocol server responds with a MoveItemSoapOut response WSDL message.");

            Site.Assert.IsNotNull(this.infoItems[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_R162");
        
            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R162
            Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                this.infoItems[0].ResponseClass,
                162,
                @"[In MoveItem] If the MoveItem WSDL operation request is successful, the server returns a MoveItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.7.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". ");

            Site.Assert.IsNotNull(this.infoItems[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_R163");
        
            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R163
            Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.NoError,
                this.infoItems[0].ResponseCode,
                163,
                @"[In MoveItem] [A successful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element is set to ""NoError"". ");
            #endregion
            #endregion

            #region Delete the moved message
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                ItemIds = new ItemIdType[]
                {
                   moveItemIdType
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion
        }
        public void MSOXWSMSG_S04_TC02_MoveMessageUnsuccessful()
        {
            #region Create 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.
            ItemIdType itemIdType = new ItemIdType();
            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 Delete the message created
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                ItemIds = new ItemIdType[]
                {
                   this.firstItemOfFirstInfoItem.ItemId
                }
            };

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

            #region Move message
            MoveItemType moveItemRequest = new MoveItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                // Set target folder to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);
            
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R163001");

            this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Error,
                moveItemResponse.ResponseMessages.Items[0].ResponseClass,
                163001,
                @"[In MoveItem] If the MoveItem WSDL operation request is not successful, it returns a MoveItemResponse element with the ResponseClass attribute of the MoveItemResponseMessage element set to ""Error"". ");

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

            this.Site.CaptureRequirementIfIsTrue(
                System.Enum.IsDefined(typeof(ResponseCodeType), moveItemResponse.ResponseMessages.Items[0].ResponseCode),
                163002,
                @"[In MoveItem] [A unsuccessful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element of the MoveItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24.");

            #endregion
        }
        public void MSOXWSMTGS_S04_TC04_MoveItemErrorCalendarCannotMoveOrCopyOccurrence()
        {
            #region Define a recurring calendar item
            DateTime startTime = DateTime.Now;

            DailyRecurrencePatternType pattern = new DailyRecurrencePatternType();
            pattern.Interval = this.PatternInterval;

            NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
            range.NumberOfOccurrences = this.NumberOfOccurrences;
            range.StartDate           = startTime;

            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID              = Guid.NewGuid().ToString();
            calendarItem.Subject          = this.Subject;
            calendarItem.Start            = startTime;
            calendarItem.StartSpecified   = true;
            calendarItem.End              = startTime.AddHours(this.TimeInterval);
            calendarItem.EndSpecified     = true;
            calendarItem.Recurrence       = new RecurrenceType();
            calendarItem.Recurrence.Item  = pattern;
            calendarItem.Recurrence.Item1 = range;
            #endregion

            #region Create the recurring calendar item and extract the Id of an occurrence item
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);

            OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType();
            occurrenceItemId.ChangeKey         = item.Items.Items[0].ItemId.ChangeKey;
            occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id;
            occurrenceItemId.InstanceIndex     = this.InstanceIndex;
            #endregion

            #region Copy one occurrence of the recurring calendar item
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.drafts;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            MoveItemType moveItemRequest = new MoveItemType();
            moveItemRequest.ItemIds    = new BaseItemIdType[] { occurrenceItemId };
            moveItemRequest.ToFolderId = targetFolderId;
            MoveItemResponseType response = this.MTGSAdapter.MoveItem(moveItemRequest);

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1228
            Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Error,
                response.ResponseMessages.Items[0].ResponseClass,
                1228,
                @"[In Messages] If the request is unsuccessful, the MoveItem operation returns a MoveItemResponse element with the ResponseClass attribute of the MoveItemResponseMessage element set to ""Error"". ");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1231
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorCalendarCannotMoveOrCopyOccurrence,
                response.ResponseMessages.Items[0].ResponseCode,
                1231,
                @"[In Messages] ErrorCalendarCannotMoveOrCopyOccurrence: Specifies that an attempt was made to move or copy an occurrence of a recurring calendar item.");
            #endregion

            #region Clean up organizer's calendar folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar
            });
            #endregion
        }
        public void MSOXWSCONT_S04_TC01_MoveContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            #endregion

            #region Step 2:Move the contact item.
            MoveItemType moveItemRequest = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the moved contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the original contact item Id.
            // Call GetItem operation.
            getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual<int>(
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0),
                 "Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorItemNotFound,
                getItemResponse.ResponseMessages.Items[0].ResponseCode,
                string.Format(
                    "Get contact item with original item Id should fail! Expected response code: {0}, actual response code: {1}",
                    ResponseCodeType.ErrorItemNotFound,
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion
        }
        public void MSOXWSMTGS_S04_TC05_MoveItemErrorCalendarCannotUseIdForOccurrenceId()
        {
            #region Define a meeting
            int timeInterval             = this.TimeInterval;
            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.UID     = Guid.NewGuid().ToString();
            meetingItem.Subject = this.Subject;
            meetingItem.Start   = DateTime.UtcNow;

            meetingItem.StartSpecified = true;
            timeInterval++;
            meetingItem.End          = DateTime.Now.AddHours(timeInterval);
            meetingItem.EndSpecified = true;
            meetingItem.Location     = this.Location;

            meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };

            // Create the  meeting
            ItemInfoResponseMessageType itemInfo = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy);
            Site.Assert.IsNotNull(itemInfo, "Server should return success for creating a recurring meeting.");

            CalendarItemType calendarInOrganizer = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendarInOrganizer, "The meeting should be found in organizer's Calendar folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy.");
            #endregion

            #region Define a recurring calendar item to move
            DateTime startTime = DateTime.Now;

            DailyRecurrencePatternType pattern = new DailyRecurrencePatternType();
            pattern.Interval = this.PatternInterval;

            NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
            range.NumberOfOccurrences = this.NumberOfOccurrences;
            range.StartDate           = startTime;

            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID              = Guid.NewGuid().ToString();
            calendarItem.Subject          = this.Subject;
            calendarItem.Start            = startTime;
            calendarItem.StartSpecified   = true;
            calendarItem.End              = startTime.AddHours(this.TimeInterval);
            calendarItem.EndSpecified     = true;
            calendarItem.Recurrence       = new RecurrenceType();
            calendarItem.Recurrence.Item  = pattern;
            calendarItem.Recurrence.Item1 = range;
            #endregion

            #region Create the recurring calendar item and extract the Id of an occurrence item
            ItemInfoResponseMessageType item             = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);
            OccurrenceItemIdType        occurrenceItemId = new OccurrenceItemIdType();
            occurrenceItemId.ChangeKey         = item.Items.Items[0].ItemId.ChangeKey;
            occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id;
            occurrenceItemId.InstanceIndex     = this.InstanceIndex;
            #endregion

            #region Get the Id of the occurrence item
            ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Organizer, occurrenceItemId);
            Site.Assert.IsNotNull(getItem, "Organizer should get the occurrence item successfully.");

            RecurringMasterItemIdType recurringMasterItemId = new RecurringMasterItemIdType();
            recurringMasterItemId.ChangeKey    = getItem.Items.Items[0].ItemId.ChangeKey;
            recurringMasterItemId.OccurrenceId = calendarInOrganizer.ItemId.Id;
            #endregion

            #region Move the recurring calendar item to Inbox folder
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.inbox;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            MoveItemType moveItemRequest = new MoveItemType();
            moveItemRequest.ItemIds    = new BaseItemIdType[] { recurringMasterItemId };
            moveItemRequest.ToFolderId = targetFolderId;
            MoveItemResponseType response = this.MTGSAdapter.MoveItem(moveItemRequest);
            #endregion

            #region Capture code
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1232");

            //Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1232
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorCalendarCannotUseIdForOccurrenceId,
                response.ResponseMessages.Items[0].ResponseCode,
                1232,
                @"[In Messages] ErrorCalendarCannotUseIdForOccurrenceId: Specifies that the OccurrenceId ([MS-OXWSCORE] section 2.2.4.39) does not correspond to a valid occurrence of a recurring master item.");
            #endregion

            #region Clean up organizer's calendar, sentitems and deleteditems folders and attendee's calendar, inbox and deleteditems folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType> {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems
            });
            this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.deleteditems
            });
            #endregion
        }
        /// <summary>
        /// Move the calendar related item elements.
        /// </summary>
        /// <param name="request">A request to the MoveItem operation.</param>
        /// <returns>The response message returned by MoveItem operation.</returns>
        public MoveItemResponseType MoveItem(MoveItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'MoveItem' should not be null.");
            }

            MoveItemResponseType moveItemResponse = this.exchangeServiceBinding.MoveItem(request);
            Site.Assert.IsNotNull(moveItemResponse, "If the operation is successful, the response should not be null.");

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyMoveItemOperation(moveItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            return moveItemResponse;
        }
Exemplo n.º 25
0
 /// <remarks/>
 public System.IAsyncResult BeginMoveItem(MoveItemType MoveItem1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("MoveItem", new object[] {
             MoveItem1}, callback, asyncState);
 }
        /// <summary>
        /// Moves Task items on the server.
        /// </summary>
        /// <param name="moveItemRequest">Specifies a request to move Task items on the server.</param>
        /// <returns>A response to this operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType moveItemResponse = this.exchangeServiceBinding.MoveItem(moveItemRequest);
            Site.Assert.IsNotNull(moveItemResponse, "If the operation is successful, the response should not be null.");

            // Verify the move item operation.
            this.VerifyMoveItemOperation(moveItemResponse, this.exchangeServiceBinding.IsSchemaValidated);

            // Verify Soap version requirements.
            this.VerifySoapVersion();

            // Verify transport requirements.
            this.VerifyTransportType();

            return moveItemResponse;
        }
Exemplo n.º 27
0
 /// <remarks/>
 public void MoveItemAsync(MoveItemType MoveItem1, object userState)
 {
     if ((this.MoveItemOperationCompleted == null))
     {
         this.MoveItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMoveItemOperationCompleted);
     }
     this.InvokeAsync("MoveItem", new object[] {
             MoveItem1}, this.MoveItemOperationCompleted, userState);
 }
Exemplo n.º 28
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
        }
Exemplo n.º 29
0
        public void MSOXWSMSG_S04_TC01_MoveMessage()
        {
            #region Create 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.
            ItemIdType itemIdType = new ItemIdType();
            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 Move message
            MoveItemType moveItemRequest = new MoveItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                // Set target folder to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(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 message responseMessageItem got from the moveItem response.
            ItemIdType moveItemIdType = new ItemIdType();
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            moveItemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            moveItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Verify whether the message is moved to junkemail folder.
            string userName         = Common.GetConfigurationPropertyValue("Sender", this.Site);
            string password         = Common.GetConfigurationPropertyValue("SenderPassword", this.Site);
            string domain           = Common.GetConfigurationPropertyValue("Domain", this.Site);
            bool   findItemInDrafts = this.IsItemAvailableAfterMoveOrDelete(userName, password, domain, "drafts", this.Subject, "itemSubject");
            Site.Assert.IsFalse(findItemInDrafts, "The item should not be found in the drafts folder of Sender.");

            bool findItemInJunkemail = this.SearchItems(Role.Sender, "junkemail", this.Subject, "itemSubject");
            Site.Assert.IsTrue(findItemInJunkemail, "The item should be found in the junkemail folder of Sender.");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R161
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                161,
                @"[In MoveItem] The protocol client sends a MoveItemSoapIn request WSDL message, and the protocol server responds with a MoveItemSoapOut response WSDL message.");

            Site.Assert.IsNotNull(this.infoItems[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_R162");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R162
            Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                this.infoItems[0].ResponseClass,
                162,
                @"[In MoveItem] If the MoveItem WSDL operation request is successful, the server returns a MoveItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.7.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". ");

            Site.Assert.IsNotNull(this.infoItems[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_R163");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R163
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.NoError,
                this.infoItems[0].ResponseCode,
                163,
                @"[In MoveItem] [A successful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element is set to ""NoError"". ");
            #endregion
            #endregion

            #region Delete the moved message
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                ItemIds = new ItemIdType[]
                {
                    moveItemIdType
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion
        }
Exemplo n.º 30
0
        public void MSOXWSCONT_S06_TC01_OperateContactItemWithoutOptionalElements()
        {
            #region Step 1:Create the contact item.
            // Create a contact item without optional elements.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);
            #endregion

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 5:Copy the contact item.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[1];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            #endregion
        }