public async Task <SharedLookUpResponse> UpdateComponentAsync(UpdateItemType updateComponentAc, int instituteId)
        {
            var componentGroups = await iMSDbContext.ItemTypes.Where(x => x.InstituteId == instituteId && x.Id != updateComponentAc.Id).ToListAsync();

            var isDuplicated = componentGroups.Any(x => x.Code.ToLowerInvariant() == updateComponentAc.Code.ToLowerInvariant());

            if (isDuplicated)
            {
                return new SharedLookUpResponse()
                       {
                           HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Duplicate Code of Item type, please use unique code"
                       }
            }
            ;
            else
            {
                var componentGroup = await iMSDbContext.ItemTypes.FirstAsync(x => x.Id == updateComponentAc.Id);

                componentGroup.Name        = updateComponentAc.Name;
                componentGroup.Code        = updateComponentAc.Code;
                componentGroup.Description = updateComponentAc.Description;
                componentGroup.Status      = updateComponentAc.Status;
                iMSDbContext.ItemTypes.Update(componentGroup);
                await iMSDbContext.SaveChangesAsync();

                return(new SharedLookUpResponse()
                {
                    HasError = false, Message = "Item type updated successfully"
                });
            }
        }
            public UpdateItem(string moviepath, UpdateItemType itemtype)
            {
                MoviePath = moviepath;
                ItemType  = itemtype;

                GetTargetPath();
            }
Example #3
0
 public void Reset()
 {
     AddItemAction = GameCmd.AddItemAction.AddItemAction_Normal;
     UpdateType    = UpdateItemType.None;
     QWThisId      = 0;
     BaseId        = 0;
     ChangeNum     = 0;
 }
Example #4
0
        /// <summary>
        /// Update contact item on the server.
        /// </summary>
        /// <param name="updateItemRequest">The request of UpdateItem operation.</param>
        /// <returns>A response to UpdateItem operation request.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

            #region Verify UpdateItem operation requirements

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

            return(updateItemResponse);
        }
Example #5
0
        /// <summary>
        /// Update tasks on the server according to items' id.
        /// </summary>
        /// <param name="itemIds">The item id of tasks which will be updated.</param>
        /// <returns>The extracted items id array.</returns>
        protected ItemIdType[] UpdateTasks(params ItemIdType[] itemIds)
        {
            // Define the UpdateItem request.
            UpdateItemType updateItemRequest = TestSuiteHelper.GenerateUpdateItemRequest(itemIds);

            // Call the UpdateItem method to update the task items created in previous steps.
            UpdateItemResponseType updateItemResponse = this.TASKAdapter.UpdateItem(updateItemRequest);

            this.VerifyResponseMessage(updateItemResponse);

            // Save the ItemId of task item got from the updateItem response.
            return(Common.GetItemIdsFromInfoResponse(updateItemResponse));
        }
        public void MSOXWSCORE_S08_TC05_UpdateTypesOfItemsFailed()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST");

            #region Step 1: Create Items.
            ItemIdType[] createdItemIds = CreateAllTypesItems();
            #endregion

            #region Step 2: Update items.
            // Initialize the change item to update.
            UpdateItemType   updateRequest = new UpdateItemType();
            ItemChangeType[] itemChanges   = new ItemChangeType[createdItemIds.Length];

            // Set two properties (Subject and ReminderMinutesBeforeStart) to update, in order to return an error "ErrorIncorrectUpdatePropertyCount".
            for (int i = 0; i < createdItemIds.Length; i++)
            {
                itemChanges[i]         = new ItemChangeType();
                itemChanges[i].Item    = createdItemIds[i];
                itemChanges[i].Updates = new ItemChangeDescriptionType[1];
                SetItemFieldType setItem1 = new SetItemFieldType();
                setItem1.Item = new PathToUnindexedFieldType()
                {
                    FieldURI = UnindexedFieldURIType.itemSubject
                };
                setItem1.Item1 = new ContactItemType()
                {
                    Subject = Common.GenerateResourceName(
                        this.Site,
                        TestSuiteHelper.SubjectForUpdateItem),
                    ReminderMinutesBeforeStart = TestSuiteHelper.ReminderMinutesBeforeStart
                };
                itemChanges[i].Updates[0] = setItem1;
            }

            updateRequest.ItemChanges = itemChanges;
            updateRequest.MessageDispositionSpecified                    = true;
            updateRequest.MessageDisposition                             = MessageDispositionType.SaveOnly;
            updateRequest.SendMeetingInvitationsOrCancellations          = CalendarItemUpdateOperationType.SendToAllAndSaveCopy;
            updateRequest.SendMeetingInvitationsOrCancellationsSpecified = true;

            // Call UpdateItem to update the Subject and the ReminderMinutesBeforeStart of the created item simultaneously.
            UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateRequest);

            foreach (ResponseMessageType responseMessage in updateItemResponse.ResponseMessages.Items)
            {
                // Verify ResponseCode is ErrorIncorrectUpdatePropertyCount.
                this.VerifyErrorIncorrectUpdatePropertyCount(responseMessage.ResponseCode);
            }
            #endregion
        }
Example #7
0
        /// <summary>
        /// Update the calendar related item elements.
        /// </summary>
        /// <param name="request">A request to the UpdateItem operation.</param>
        /// <returns>The response message returned by UpdateItem operation.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'UpdateItem' should not be null.");
            }

            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(request);

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

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyUpdateItemOperation(updateItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            return(updateItemResponse);
        }
        /// <summary>
        /// Update items on the server.
        /// </summary>
        /// <param name="updateItemRequest">Specify a request to update items on the server.</param>
        /// <returns>A response to UpdateItem operation request.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType response = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

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

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

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

            this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated);
            this.VerifyUpdateItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
Example #9
0
        private void UpdateCalendarItem(ItemChangeType[] changes)
        {
            UpdateItemType updateItemRequest = new UpdateItemType();

            updateItemRequest.ConflictResolution = ConflictResolutionType.AlwaysOverwrite;
            updateItemRequest.ItemChanges        = changes;
            updateItemRequest.SendMeetingInvitationsOrCancellations          = CalendarItemUpdateOperationType.SendToNone;
            updateItemRequest.SendMeetingInvitationsOrCancellationsSpecified = true;

            UpdateItemResponseType response        = Service.UpdateItem(updateItemRequest);
            ResponseMessageType    responseMessage = response.ResponseMessages.Items[0];

            if (responseMessage.ResponseCode != ResponseCodeType.NoError)
            {
                throw new Exception("UpdateItem failed with response code " + responseMessage.ResponseCode);
            }
        }
        /// <summary>
        /// Sets the message importance flag.
        /// </summary>
        public void SetMessageImportance(ItemIdType messageId, bool isStarred)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var setField = new SetItemFieldType
            {
                Item1 = new MessageType {
                    Importance = isStarred ? ImportanceChoicesType.High : ImportanceChoicesType.Normal, ImportanceSpecified = true
                },
                Item = new PathToUnindexedFieldType {
                    FieldURI = UnindexedFieldURIType.itemImportance
                }
            };

            var updatedItems = new[]
            {
                new ItemChangeType
                {
                    Updates = new ItemChangeDescriptionType[] { setField },
                    Item    = messageId
                }
            };

            var request = new UpdateItemType
            {
                ItemChanges                 = updatedItems,
                ConflictResolution          = ConflictResolutionType.AutoResolve,
                MessageDisposition          = MessageDispositionType.SaveOnly,
                MessageDispositionSpecified = true
            };

            UpdateItemResponseType updateItemResponse = binding.UpdateItem(request);

            if (updateItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(updateItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
        /// <summary>
        /// Update item on the server.
        /// </summary>
        /// <param name="updateItemRequest">Update item operation request type.</param>
        /// <returns>Update item operation response type.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

            return(updateItemResponse);
        }
 /// <remarks/>
 public System.IAsyncResult BeginUpdateItem(UpdateItemType UpdateItem1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UpdateItem", new object[] {
                 UpdateItem1}, callback, asyncState);
 }
Example #13
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
        }
Example #14
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
        }
Example #15
0
    private void UpdateCounters(UpdateItemType type)
    {
        switch (type)
        {
        case UpdateItemType.Modem:
            lbl1ItemCounter.Text  = lstb1ID.Items.Count.ToString();
            lbl1AddedCounter.Text = lstb1Added.Items.Count.ToString();
            break;

        case UpdateItemType.Token:
            lbl2ItemCounter.Text  = lstb2Serialnumber.Items.Count.ToString();
            lbl2AddedCounter.Text = lstb2Added.Items.Count.ToString();
            break;

        case UpdateItemType.Laptop:
            lbl3ItemCounter.Text  = lstb3Serialnumber.Items.Count.ToString();
            lbl3AddedCounter.Text = lstb3Added.Items.Count.ToString();
            break;

        case UpdateItemType.Printer:
            lbl4ItemCounter.Text  = lstb4Serialnumber.Items.Count.ToString();
            lbl4AddedCounter.Text = lstb4Added.Items.Count.ToString();
            break;

        case UpdateItemType.Projector:
            lbl5ItemCounter.Text  = lstb5Serialnumber.Items.Count.ToString();
            lbl5AddedCounter.Text = lstb5Added.Items.Count.ToString();
            break;

        case UpdateItemType.USBkey:
            lbl6ItemCounter.Text  = lstb6Serialnumber.Items.Count.ToString();
            lbl6AddedCounter.Text = lstb6Added.Items.Count.ToString();
            break;

        case UpdateItemType.Phone:
            lbl7ItemCounter.Text  = lstb7ID.Items.Count.ToString();
            lbl7AddedCounter.Text = lstb7Added.Items.Count.ToString();
            break;

        case UpdateItemType.SIMcard:
            lbl8ItemCounter.Text  = lstb8SIMcardnr.Items.Count.ToString();
            lbl8AddedCounter.Text = lstb8Added.Items.Count.ToString();
            break;

        case UpdateItemType.All:
            lbl1ItemCounter.Text  = lstb1ID.Items.Count.ToString();
            lbl1AddedCounter.Text = lstb1Added.Items.Count.ToString();
            lbl2ItemCounter.Text  = lstb2Serialnumber.Items.Count.ToString();
            lbl2AddedCounter.Text = lstb2Added.Items.Count.ToString();
            lbl3ItemCounter.Text  = lstb3Serialnumber.Items.Count.ToString();
            lbl3AddedCounter.Text = lstb3Added.Items.Count.ToString();
            lbl4ItemCounter.Text  = lstb4Serialnumber.Items.Count.ToString();
            lbl4AddedCounter.Text = lstb4Added.Items.Count.ToString();
            lbl5ItemCounter.Text  = lstb5Serialnumber.Items.Count.ToString();
            lbl5AddedCounter.Text = lstb5Added.Items.Count.ToString();
            lbl6ItemCounter.Text  = lstb6Serialnumber.Items.Count.ToString();
            lbl6AddedCounter.Text = lstb6Added.Items.Count.ToString();
            lbl7ItemCounter.Text  = lstb7ID.Items.Count.ToString();
            lbl7AddedCounter.Text = lstb7Added.Items.Count.ToString();
            lbl8ItemCounter.Text  = lstb8SIMcardnr.Items.Count.ToString();
            lbl8AddedCounter.Text = lstb8Added.Items.Count.ToString();
            break;

        default:
            break;
        }
    }
        public void MSOXWSCONT_S02_TC01_UpdateContactItem()
        {
            #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);
            #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
            };

            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: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);

            ContactItemType[] contacts = Common.GetItemsFromInfoResponse <ContactItemType>(getItemResponse);

            Site.Assert.AreEqual <int>(
                1,
                contacts.Length,
                string.Format(
                    "The count of items from response should be 1, actual: '{0}'.", contacts.Length));

            Site.Assert.AreEqual <string>(
                FileAsMappingType.LastFirstCompany.ToString(),
                contacts[0].FileAs,
                string.Format(
                    "The FileAs property should be updated as set. Expected value: {0}, actual value: {1}", FileAsMappingType.LastFirstCompany.ToString(), contacts[0].FileAs));
            #endregion
        }
 /// <remarks/>
 public void UpdateItemAsync(UpdateItemType UpdateItem1)
 {
     this.UpdateItemAsync(UpdateItem1, null);
 }
 /// <remarks/>
 public void UpdateItemAsync(UpdateItemType UpdateItem1, object userState)
 {
     if ((this.UpdateItemOperationCompleted == null))
     {
         this.UpdateItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateItemOperationCompleted);
     }
     this.InvokeAsync("UpdateItem", new object[] {
                 UpdateItem1}, this.UpdateItemOperationCompleted, userState);
 }
Example #19
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
        }