Beispiel #1
0
        protected virtual ItemChangeType GetAppointmentChanges(Appointment apt)
        {
            ItemChangeType itemUpdates = new ItemChangeType();

            ItemIdType itemId = new ItemIdType();

            itemId.Id        = apt.Attributes[ExchangeIdAttribute];
            itemId.ChangeKey = apt.Attributes[ExchangeChangeKeyAttribute];

            itemUpdates.Item = itemId;
            List <ItemChangeDescriptionType> updates = new List <ItemChangeDescriptionType>();

            updates.Add(GetSubjectUpdate(apt));
            updates.Add(GetStartUpdate(apt));
            updates.Add(GetEndUpdate(apt));

            if (apt.RecurrenceRule != string.Empty)
            {
                updates.Add(GetRecurrenceUpdate(apt));
            }

            itemUpdates.Updates = updates.ToArray();

            return(itemUpdates);
        }
        /// <summary>
        /// Gets a specific message from exchange by id (attachments are only loaded shallow).
        /// </summary>
        /// <param name="messageId"></param>
        /// <returns></returns>
        public MessageType GetMessage(string messageId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            ItemIdType itemId = new ItemIdType();

            itemId.Id = messageId;

            GetItemType getItemRequest = new GetItemType();

            getItemRequest.ItemShape = new ItemResponseShapeType {
                BaseShape = DefaultShapeNamesType.AllProperties
            };
            getItemRequest.ItemIds = new[] { itemId };

            GetItemResponseType getItemResponse = binding.GetItem(getItemRequest);

            if (getItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(getItemResponse.ResponseMessages.Items[0].MessageText);
            }

            var getItemResponseMessage = (ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0];

            if (getItemResponseMessage.Items.Items == null || getItemResponseMessage.Items.Items.Length == 0)
            {
                throw new ApplicationException("Error in GetMessage, empty ItemInfoResponseMessageType");
            }

            return((MessageType)getItemResponseMessage.Items.Items[0]);
        }
        public void MSOXWSTASK_S04_TC01_VerifyMoveTaskItem()
        {
            #region Client calls CreateItem to create a task item on server. By default, it is created in task folder.
            string       subject       = Common.GenerateResourceName(this.Site, "This is a task");
            ItemIdType[] createItemIds = this.CreateTasks(TestSuiteHelper.DefineTaskItem(subject, null));
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null);
            ItemIdType createItemId = createItemIds[0];
            #endregion

            #region Client calls MoveItem to move the task item to deleteditems folder.
            ItemIdType[] moveItemIds = this.MoveTasks(createItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This move response status should be success!", null);
            ItemIdType moveItemId = moveItemIds[0];
            #endregion

            #region Client calls GetItem to check whether the task item is moved.
            this.GetTasks(createItemId);
            Site.Assert.AreNotEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should not be success! The created task has been moved.", null);
            this.GetTasks(moveItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null);
            #endregion

            #region Client calls DeleteItem to delete the task item created in the previous steps.
            this.DeleteTasks(moveItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null);
            #endregion
        }
Beispiel #4
0
        public void MSOXWSTASK_S06_TC03_OperateTaskItemWithIsCompleteElement()
        {
            #region Client calls CreateItem operation to create a task item with task Status equal to Completed.
            // Save the ItemId of task item got from the createItem response.
            string       subject            = Common.GenerateResourceName(this.Site, "This is a task");
            ItemIdType[] createItemIdsFirst = this.CreateTasks(TestSuiteHelper.DefineTaskItem(subject, TaskStatusType.Completed));
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null);
            ItemIdType createItemIdFirst = createItemIdsFirst[0];
            #endregion

            #region Client call GetItem operation to get the task item.
            TaskType[] retrievedTaskItemsFirst = this.GetTasks(createItemIdFirst);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null);
            TaskType retrievedTaskItemFirst = retrievedTaskItemsFirst[0];
            #endregion

            #region Verify the IsComplete element value
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R5555");

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R5555
            this.Site.CaptureRequirementIfIsTrue(
                retrievedTaskItemFirst.IsComplete,
                5555,
                @"[In t:TaskType Complex Type] [IsComplete is] True, indicates a task has been completed.");

            #endregion

            #region Client calls CreateItem operation to create a task item with task Status equal to InProgress.
            // Save the ItemId of task item got from the createItem response.
            subject = Common.GenerateResourceName(this.Site, "This is a task");
            ItemIdType[] createItemIdsSecond = this.CreateTasks(TestSuiteHelper.DefineTaskItem(subject, TaskStatusType.InProgress));
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null);
            ItemIdType createItemIdSecond = createItemIdsSecond[0];
            #endregion

            #region Client call GetItem operation to get the task item.
            TaskType[] retrievedTaskItemsSecond = this.GetTasks(createItemIdSecond);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null);
            TaskType retrievedTaskItemSecond = retrievedTaskItemsSecond[0];
            #endregion

            #region Verify the IsComplete element value

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R5556
            this.Site.CaptureRequirementIfIsFalse(
                retrievedTaskItemSecond.IsComplete,
                5556,
                @"[In t:TaskType Complex Type] [IsComplete is] False, indicates a task has not been completed.");

            #endregion

            #region Client calls DeleteItem to delete the task items created in the previous steps.
            this.DeleteTasks(createItemIdFirst, createItemIdSecond);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null);
            #endregion
        }
        public void MSOXWSMTGS_S05_TC04_MoveMultipleCalendarItems()
        {
            #region Define two calendar items to move
            CalendarItemType calendarItem1 = new CalendarItemType();
            calendarItem1.UID     = Guid.NewGuid().ToString();
            calendarItem1.Subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
            CalendarItemType calendarItem2 = new CalendarItemType();
            calendarItem2.UID     = Guid.NewGuid().ToString();
            calendarItem2.Subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
            #endregion

            #region Create the two calendar items
            ItemInfoResponseMessageType[] calendars = this.CreateMultipleCalendarItems(Role.Organizer, new ItemType[] { calendarItem1, calendarItem2 }, CalendarItemCreateOrDeleteOperationType.SendToNone);
            Site.Assert.IsNotNull(calendars, "The calendars should be created successfully.");
            Site.Assert.IsTrue(calendars.Length == 2, "There should be only two calendars created.");

            ItemIdType[] calendarIds = new ItemIdType[] { calendars[0].Items.Items[0].ItemId, calendars[1].Items.Items[0].ItemId };
            #endregion

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

            Site.Assert.IsNotNull(
                this.MoveMultipleCalendarItems(Role.Organizer, calendarIds, targetFolderId),
                "The calendars should be moved into the inbox folder successfully.");

            #endregion

            #region Call FindItem to verify the two calendar items are moved to Inbox folder
            Site.Assert.IsNull(
                this.SearchDeletedSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", calendarItem1.UID),
                "The original calendar should not be in organizer's calendar folder after MoveItem operation.");

            Site.Assert.IsNotNull(
                this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Appointment", calendarItem1.UID),
                "The original calendar should be in organizer's inbox folder after MoveItem operation.");

            Site.Assert.IsNull(
                this.SearchDeletedSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", calendarItem2.UID),
                "The original calendar should not be in organizer's calendar folder after MoveItem operation.");

            Site.Assert.IsNotNull(
                this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Appointment", calendarItem2.UID),
                "The original calendar should be in organizer's inbox folder after MoveItem operation.");
            #endregion

            #region Clean up organizer's inbox folder.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.inbox
            });
            #endregion
        }
        public void MSOXWSTASK_S05_TC01_OperateMultipleTaskItems()
        {
            #region Client calls CreateItem to create two task items on server.
            string       firstSubject  = Common.GenerateResourceName(this.Site, "This is a task", 1);
            string       secondSubject = Common.GenerateResourceName(this.Site, "This is a task", 2);
            ItemIdType[] createItemIds = this.CreateTasks(TestSuiteHelper.DefineTaskItem(firstSubject), TestSuiteHelper.DefineTaskItem(secondSubject));
            Site.Assert.IsNotNull(createItemIds, "This create response should have task item id!");
            Site.Assert.AreEqual <int>(2, createItemIds.Length, "There should be 2 task items' ids in response!");
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status of first task item should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This create response status of second task item should be success!", null);
            #endregion

            #region Client calls GetItem to get two task items.
            TaskType[] taskItems = this.GetTasks(createItemIds);
            Site.Assert.IsNotNull(taskItems, "This get response should have task items!");
            Site.Assert.AreEqual <int>(2, taskItems.Length, "There should be 2 task items in response!");
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status of first task item should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This get response status of second task item should be success!", null);
            #endregion

            #region Client calls UpdateItem to update the value of taskCompanies element of task item.
            ItemIdType[] updateItemIds = this.UpdateTasks(createItemIds);
            Site.Assert.IsNotNull(updateItemIds, "This update response should have task item id!");
            Site.Assert.AreEqual <int>(2, updateItemIds.Length, "There should be 2 task items' ids in response!");
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This update response status of first task item should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This update response status of second task item should be success!", null);
            #endregion

            #region Client calls CopyItem to copy the two task items.
            ItemIdType[] copyItemIds = this.CopyTasks(updateItemIds);
            Site.Assert.IsNotNull(copyItemIds, "This copy response should have task item id!");
            Site.Assert.AreEqual <int>(2, copyItemIds.Length, "There should be 2 task items' ids in response!");
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This copy response status of first task item should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This copy response status of second task item should be success!", null);
            #endregion

            #region Client calls MoveItem to move the task items to deleteditems folder
            ItemIdType[] moveItemIds = this.MoveTasks(updateItemIds);
            Site.Assert.IsNotNull(moveItemIds, "This move response should have task item id!");
            Site.Assert.AreEqual <int>(2, moveItemIds.Length, "There should be 2 task items' ids in response!");
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This move response status of first task item should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This move response status of second task item should be success!", null);
            #endregion

            #region Client calls DeleteItem to delete the task items created in the previous steps.
            ItemIdType[] deleteItemIds = new ItemIdType[copyItemIds.Length + moveItemIds.Length];
            copyItemIds.CopyTo(deleteItemIds, 0);
            moveItemIds.CopyTo(deleteItemIds, copyItemIds.Length);
            this.DeleteTasks(deleteItemIds);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status of first task item should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This delete response status of second task item should be success!", null);
            #endregion
        }
Beispiel #7
0
        /// <summary>
        /// Deletes the specified appointment.
        /// </summary>
        /// <param name="owner">The owner RadScheduler instance.</param>
        /// <param name="appointmentToDelete">The appointment to delete.</param>
        public override void Delete(RadScheduler owner, Appointment appointmentToDelete)
        {
            if (owner.ProviderContext is RemoveRecurrenceExceptionsContext)
            {
                return;
            }

            ItemIdType itemId = new ItemIdType();

            itemId.Id        = appointmentToDelete.Attributes[ExchangeIdAttribute];
            itemId.ChangeKey = appointmentToDelete.Attributes[ExchangeChangeKeyAttribute];

            DeleteItem(itemId);
        }
Beispiel #8
0
        public void MSOXWSMTGS_S03_TC01_CopySingleCalendar()
        {
            #region Define a calendar item to copy
            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID     = Guid.NewGuid().ToString();
            calendarItem.Subject = this.Subject;
            #endregion

            #region Create the calendar item with CalendarItemCreateOrDeleteOperationType set to SendToNone
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);
            Site.Assert.IsNotNull(item, "Create a calendar item should be successful.");
            ItemIdType calendarId = item.Items.Items[0].ItemId;
            #endregion

            #region Copy the calendar item to Drafts folder
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.drafts;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            ItemInfoResponseMessageType copiedItem = this.CopySingleCalendarItem(Role.Organizer, calendarId, targetFolderId);

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R602
            this.Site.CaptureRequirementIfIsNotNull(
                copiedItem,
                602,
                @"[In Messages] CopyItemSoapIn: For each item being copied that is not a recurring calendar item, the ItemIds element MUST contain an ItemId child element ([MS-OXWSCORE] section 2.2.4.11).");
            #endregion

            #region Call GetItem operation to verify whether the calendar item is really copied
            CalendarItemType calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.drafts, "IPM.Appointment", calendarItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The calendar item should be in organizer's drafts folder.");

            CalendarItemType calendarInCalendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", calendarItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendarInCalendar, "The calendar item should also be in organizer's calendar folder.");
            #endregion

            #region Clean up organizer's drafts and calendar folders
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.drafts
            });
            #endregion
        }
Beispiel #9
0
        private void SynchronizeDeletedOccurrences(Appointment apt)
        {
            RecurrenceRule rrule;

            if (!RecurrenceRule.TryParse(apt.RecurrenceRule, out rrule))
            {
                return;
            }

            ItemIdType itemId = new ItemIdType();

            itemId.Id        = apt.Attributes[ExchangeIdAttribute];
            itemId.ChangeKey = apt.Attributes[ExchangeChangeKeyAttribute];
            CalendarItemType calendarItem = GetCalendarItems(new ItemIdType[] { itemId })[0];

            List <DateTime> existingExceptions = new List <DateTime>();

            if (calendarItem.ModifiedOccurrences != null)
            {
                foreach (CalendarItemType modifiedOccurrence in GetModifiedOccurrences(calendarItem))
                {
                    existingExceptions.Add(modifiedOccurrence.OriginalStart);
                }
            }

            if (calendarItem.DeletedOccurrences != null)
            {
                foreach (DeletedOccurrenceInfoType deletedOccurrence in calendarItem.DeletedOccurrences)
                {
                    existingExceptions.Add(deletedOccurrence.Start);
                }
            }

            foreach (DateTime recurrenceException in rrule.Exceptions)
            {
                // Search in ModifiedOccurrences and DeletedOccurrences for this exception.
                if (existingExceptions.Contains(recurrenceException))
                {
                    continue;
                }

                // If it is not found in either, delete the occurrence.
                int occurrenceIndex             = GetOccurrenceIndex(recurrenceException, apt);
                CalendarItemType occurrenceItem = GetOccurrenceItem(apt, occurrenceIndex);
                DeleteItem(occurrenceItem.ItemId);
            }
        }
        /// <summary>
        /// Delete the given message permanatly.
        /// </summary>
        /// <param name="messageId"></param>
        public void DeleteMessage(ItemIdType messageId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var deleteItemRequest = new DeleteItemType
            {
                ItemIds    = new BaseItemIdType[] { messageId },
                DeleteType = DisposalType.HardDelete
            };

            DeleteItemResponseType deleteResponse = binding.DeleteItem(deleteItemRequest);

            if (deleteResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(deleteResponse.ResponseMessages.Items[0].MessageText);
            }
        }
Beispiel #11
0
        /// <summary>
        /// Define general GetItem request message
        /// </summary>
        /// <param name="itemId">The item identifier of the item.</param>
        /// <param name="baseShape">The basic configuration of properties to be returned in an item response.</param>
        /// <returns>A request to get an item from a mailbox</returns>
        protected GetItemType DefineGeneralGetItemRequestMessage(ItemIdType itemId, DefaultShapeNamesType baseShape)
        {
            GetItemType getItemRequest = new GetItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemId
                },

                ItemShape = new ItemResponseShapeType
                {
                    BaseShape = baseShape,
                }
            };

            return(getItemRequest);
        }
        public void MSOXWSMTGS_S04_TC01_MoveSingleCalendar()
        {
            #region Define a calendar item to move
            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID     = Guid.NewGuid().ToString();
            calendarItem.Subject = this.Subject;
            #endregion

            #region Create the calendar item
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);
            ItemIdType calendarId            = item.Items.Items[0].ItemId;
            #endregion

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

            ItemInfoResponseMessageType movedItem = this.MoveSingleCalendarItem(Role.Organizer, calendarId, targetFolderId);

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R640
            this.Site.CaptureRequirementIfIsNotNull(
                movedItem,
                640,
                @"[In Messages] MoveItemSoapIn: For each item being moved that is not a recurring calendar item, the ItemIds element MUST contain an ItemId child element ([MS-OXWSCORE] section 2.2.4.11).");
            #endregion

            #region Verify the calendar item is moved to Inbox folder
            CalendarItemType calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Appointment", calendarItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The calendar item should be moved to Inbox folder.");

            CalendarItemType calendarInCalendar = this.SearchDeletedSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", calendarItem.UID) as CalendarItemType;
            Site.Assert.IsNull(calendarInCalendar, "The calendar item should not be in the Calendar folder.");
            #endregion

            #region Clean up organizer's inbox folder.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.inbox
            });
            #endregion
        }
Beispiel #13
0
        private CalendarItemType GetOccurrenceItem(Appointment master, int index)
        {
            ItemIdType masterItemId = new ItemIdType();

            masterItemId.Id        = master.Attributes[ExchangeIdAttribute];
            masterItemId.ChangeKey = master.Attributes[ExchangeChangeKeyAttribute];

            OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType();

            occurrenceItemId.RecurringMasterId = masterItemId.Id;
            occurrenceItemId.InstanceIndex     = index;

            PathToUnindexedFieldType calendarItemTypePath = new PathToUnindexedFieldType();

            calendarItemTypePath.FieldURI = UnindexedFieldURIType.calendarCalendarItemType;

            GetItemType getItemRequest = new GetItemType();

            getItemRequest.ItemShape                      = new ItemResponseShapeType();
            getItemRequest.ItemShape.BaseShape            = DefaultShapeNamesType.IdOnly;
            getItemRequest.ItemShape.AdditionalProperties = new BasePathToElementType[] { calendarItemTypePath };
            getItemRequest.ItemIds = new BaseItemIdType[] { masterItemId, occurrenceItemId };

            GetItemResponseType getItemResponse = Service.GetItem(getItemRequest);

            CalendarItemType occurrenceItem = null;

            foreach (ItemInfoResponseMessageType getItemResponseMessage in getItemResponse.ResponseMessages.Items)
            {
                if (getItemResponseMessage.ResponseClass == ResponseClassType.Success &&
                    getItemResponseMessage.Items.Items != null &&
                    getItemResponseMessage.Items.Items.Length > 0)
                {
                    occurrenceItem = (CalendarItemType)getItemResponseMessage.Items.Items[0];
                }
            }

            if (occurrenceItem == null)
            {
                throw new Exception("Unable to find occurrence");
            }

            return(occurrenceItem);
        }
        public void MSOXWSCONT_S03_TC01_CopyContactItem()
        {
            #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: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

            #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, 2, this.Site);
            #endregion
        }
        /// <summary>
        /// Moves the given message to the given folder.
        /// </summary>
        public void CopyMessageToFolder(ItemIdType messageId, string folderId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

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

            CopyItemResponseType moveItemResponse = binding.CopyItem(request);

            if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
        public void MSOXWSTASK_S03_TC01_VerifyCopyTaskItem()
        {
            #region Client calls CreateItem to create a task item on server.
            string       subject       = Common.GenerateResourceName(this.Site, "This is a task");
            ItemIdType[] createItemIds = this.CreateTasks(TestSuiteHelper.DefineTaskItem(subject, null));
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null);
            ItemIdType createItemId = createItemIds[0];
            #endregion

            #region Client calls CopyItem to copy the task item.
            ItemIdType[] copyItemIds = this.CopyTasks(createItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This copy response status should be success!", null);
            ItemIdType copyItemId = copyItemIds[0];
            #endregion

            #region Client calls DeleteItem to delete the created and copied task items.
            this.DeleteTasks(createItemId, copyItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[1], "This delete response status should be success!", null);
            #endregion
        }
        /// <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>
        /// Asks Exchange to send a specific message.
        /// </summary>
        /// <param name="messageId"></param>
        public void SendMessage(ItemIdType messageId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

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

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

            SendItemResponseType sendItemResponse = binding.SendItem(sendItem);

            if (sendItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(sendItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
Beispiel #19
0
        public void MSOXWSTASK_S06_TC01_OperateTaskItemWithoutOptionalElements()
        {
            #region Client calls CreateItem operation to create a task item without optional elements.
            // Save the ItemId of task item got from the createItem response.
            ItemIdType[] createItemIds = this.CreateTasks(new TaskType());
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null);
            ItemIdType createItemId = createItemIds[0];
            #endregion

            #region Client calls GetItem operation to get the task item.
            this.GetTasks(createItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null);
            #endregion

            #region Client calls UpdateItem operation to update the value of taskCompanies element of task item.
            ItemIdType[] updateItemIds = this.UpdateTasks(createItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This update response status should be success!", null);
            ItemIdType updateItemId = updateItemIds[0];
            #endregion

            #region Client calls CopyItem operation to copy the created task item.
            ItemIdType[] copyItemIds = this.CopyTasks(updateItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This copy response status should be success!", null);
            ItemIdType copyItemId = copyItemIds[0];
            #endregion

            #region Client calls MoveItem operation to move the task item.
            ItemIdType[] moveItemIds = this.MoveTasks(updateItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This move response status should be success!", null);
            ItemIdType moveItemId = moveItemIds[0];
            #endregion

            #region Client calls DeleteItem to delete the task items created in the previous steps.
            this.DeleteTasks(copyItemId, moveItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null);
            #endregion
        }
        /// <summary>
        /// Saves all attachments belonging to a specific message. This method can only be called after the message
        /// has been saved in exchange.
        /// </summary>
        /// <param name="messageId"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public IEnumerable <ItemIdType> SaveAttachments(ItemIdType messageId, ChannelMessage message)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            // Create add attachment request.
            var attachementRequest = new CreateAttachmentType();

            attachementRequest.ParentItemId = messageId;
            attachementRequest.Attachments  = new AttachmentType[message.Attachments.Count];

            for (int i = 0; i < message.Attachments.Count; i++)
            {
                var channelAttachment = message.Attachments[i];
                var exchAttachment    = new FileAttachmentType();

                exchAttachment.Name        = channelAttachment.Filename;
                exchAttachment.ContentType = MimeHelper.GetMimeType(channelAttachment.Filename);
                exchAttachment.Content     = channelAttachment.ContentStream.GetBytes();

                attachementRequest.Attachments[i] = exchAttachment;

                var saveAttachmentResponse = binding.CreateAttachment(attachementRequest);

                // Determine whether the request was a success.
                if (saveAttachmentResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
                {
                    throw new Exception(saveAttachmentResponse.ResponseMessages.Items[0].MessageText);
                }

                AttachmentIdType attachmentId = ((AttachmentInfoResponseMessageType)saveAttachmentResponse.ResponseMessages.Items[0]).Attachments[0].AttachmentId;

                yield return(new ItemIdType {
                    ChangeKey = attachmentId.RootItemChangeKey, Id = attachmentId.RootItemId
                });
            }
        }
        /// <summary>
        /// Gets the id and changekey of a specific message by id.
        /// </summary>
        /// <param name="messageId"></param>
        /// <returns></returns>
        public MessageType GetMessageId(string messageId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            ItemIdType itemId = new ItemIdType();

            itemId.Id = messageId;

            // Re-get item and changekey from exchange
            GetItemResponseType getItemResponse = binding.GetItem(new GetItemType
            {
                ItemShape = new ItemResponseShapeType {
                    BaseShape = DefaultShapeNamesType.IdOnly
                },
                ItemIds = new[] { itemId }
            });

            if (getItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(getItemResponse.ResponseMessages.Items[0].MessageText);
            }

            return((MessageType)((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0]);
        }
Beispiel #22
0
        private void RemoveRecurrenceExceptions(Appointment appointmentToUpdate)
        {
            ItemChangeType itemUpdates = new ItemChangeType();

            ItemIdType itemId = new ItemIdType();

            itemId.Id        = appointmentToUpdate.Attributes[ExchangeIdAttribute];
            itemId.ChangeKey = appointmentToUpdate.Attributes[ExchangeChangeKeyAttribute];

            itemUpdates.Item = itemId;

            PathToUnindexedFieldType deletedOccurrencesPath = new PathToUnindexedFieldType();

            deletedOccurrencesPath.FieldURI = UnindexedFieldURIType.calendarRecurrence;

            DeleteItemFieldType deletedOccurrencesUpdate = new DeleteItemFieldType();

            deletedOccurrencesUpdate.Item = deletedOccurrencesPath;

            // To reset the deleted and modified occurrences we must
            // remove the recurrence rule and then immediately restore it
            itemUpdates.Updates = new ItemChangeDescriptionType[] { deletedOccurrencesUpdate, GetRecurrenceUpdate(appointmentToUpdate) };
            UpdateCalendarItem(new ItemChangeType[] { itemUpdates });
        }
        public void MSOXWSMTGS_S05_TC02_UpdateMultipleCalendarItems()
        {
            #region Define two calendar items
            CalendarItemType calendarItem1 = new CalendarItemType();
            calendarItem1.UID      = Guid.NewGuid().ToString();
            calendarItem1.Subject  = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
            calendarItem1.Location = this.Location;

            CalendarItemType calendarItem2 = new CalendarItemType();
            calendarItem2.UID      = Guid.NewGuid().ToString();
            calendarItem2.Subject  = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
            calendarItem2.Location = this.Location;
            #endregion

            #region Create the two calendar items
            ItemInfoResponseMessageType[] calendars = this.CreateMultipleCalendarItems(Role.Organizer, new ItemType[] { calendarItem1, calendarItem2 }, CalendarItemCreateOrDeleteOperationType.SendToNone);
            Site.Assert.IsNotNull(calendars, "The calendars should be created successfully.");
            Site.Assert.IsTrue(calendars.Length == 2, "There should be only two calendars created.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1198
            // The calendars are gotten successfully, it means the calendars are created successfully.
            Site.CaptureRequirement(
                1198,
                @"[In Messages] A successful CreateItem operation returns a CreateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.2.2.2, with the ResponseClass attribute of the CreateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"".");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1199
            // The calendars are gotten successfully, it means the calendars are created successfully.
            Site.CaptureRequirement(
                1199,
                @"[In Messages] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.43, of the CreateItemResponseMessage element is set to ""NoError"".");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1217
            // The calendars are gotten successfully, this requirement can be captured.
            Site.CaptureRequirement(
                1217,
                @"[In Messages] A successful GetItem operation returns a GetItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.4.2.2, with the ResponseClass attribute of the GetItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". ");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1218
            // The calendars are gotten successfully, this requirement can be captured.
            Site.CaptureRequirement(
                1218,
                @"[In Messages] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.43, of the GetItemResponseMessage element is set to ""NoError"".");

            ItemIdType[] calendarIds = new ItemIdType[] { calendars[0].Items.Items[0].ItemId, calendars[1].Items.Items[0].ItemId };
            #endregion

            #region Update the Location element of the two created calendar items
            List <AdapterHelper> itemsChangeInfo = new List <AdapterHelper>();
            foreach (ItemIdType calendarId in calendarIds)
            {
                CalendarItemType calendarUpdate = new CalendarItemType();
                calendarUpdate.Location = this.LocationUpdate;

                AdapterHelper itemChangeInfo = new AdapterHelper();
                itemChangeInfo.FieldURI = UnindexedFieldURIType.calendarLocation;
                itemChangeInfo.Item     = calendarUpdate;
                itemChangeInfo.ItemId   = calendarId;
                itemsChangeInfo.Add(itemChangeInfo);
            }

            Site.Assert.IsNotNull(
                this.UpdateMultipleCalendarItems(Role.Organizer, itemsChangeInfo.ToArray(), CalendarItemUpdateOperationType.SendToNone),
                "Server should return success for updating multiple calendar items.");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1235
            // The updated calendars are gotten successfully, this requirement can be captured.
            Site.CaptureRequirement(
                1235,
                @"[In Messages] A successful UpdateItem operation returns an UpdateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.9.2.2, with the ResponseClass attribute of the UpdateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"".");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1236
            // The updated calendars are gotten successfully, this requirement can be captured.
            Site.CaptureRequirement(
                1236,
                @"[In Messages] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.43, of the UpdateItemResponseMessage element is set to ""NoError"".");
            #endregion

            #region Verify the Location elements of the two calendar items are updated
            ItemInfoResponseMessageType getItem1 = this.GetSingleCalendarItem(Role.Organizer, calendarIds[0]);
            Site.Assert.IsNotNull(getItem1, "The first updated item should exist.");

            CalendarItemType calendar1 = getItem1.Items.Items[0] as CalendarItemType;
            Site.Assert.AreEqual <string>(
                this.LocationUpdate,
                calendar1.Location,
                string.Format("The Location of the first updated calendar should be {0}. The actual value is {1}.", this.LocationUpdate, calendar1.Location));

            ItemInfoResponseMessageType getItem2 = this.GetSingleCalendarItem(Role.Organizer, calendarIds[1]);
            Site.Assert.IsNotNull(getItem2, "The second updated item should exist.");

            CalendarItemType calendar2 = getItem2.Items.Items[0] as CalendarItemType;
            Site.Assert.AreEqual <string>(
                this.LocationUpdate,
                calendar2.Location,
                string.Format("The Location of the second updated calendar should be {0}. The actual value is {1}.", this.LocationUpdate, calendar2.Location));
            #endregion

            #region Clean up organizer's calendar folder.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar
            });
            #endregion
        }
        public void MSOXWSMTGS_S04_TC02_MoveMeeting()
        {
            #region Define the target folder to move
            // Define the Inbox folder as the target folder for moving meeting item.
            DistinguishedFolderIdType inboxFolder = new DistinguishedFolderIdType();
            inboxFolder.Id = DistinguishedFolderIdNameType.inbox;
            TargetFolderIdType meetingTargetFolder = new TargetFolderIdType();
            meetingTargetFolder.Item = inboxFolder;

            // Define the Calendar folder as the target folder for moving meeting request message, meeting response message and meeting cancellation message.
            DistinguishedFolderIdType calendarFolder = new DistinguishedFolderIdType();
            calendarFolder.Id = DistinguishedFolderIdNameType.calendar;
            TargetFolderIdType msgTargetFolder = new TargetFolderIdType();
            msgTargetFolder.Item = calendarFolder;
            #endregion

            #region Organizer creates a meeting with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            #region Define a meeting to be moved
            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.Subject           = this.Subject;
            meetingItem.UID               = Guid.NewGuid().ToString();
            meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };
            meetingItem.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.OrganizerEmailAddress) };
            meetingItem.Resources         = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) };
            #endregion

            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            ItemIdType meetingId             = item.Items.Items[0].ItemId;
            #endregion

            #region Organizer moves the meeting item to Inbox folder
            ItemInfoResponseMessageType movedItem = this.MoveSingleCalendarItem(Role.Organizer, meetingId, meetingTargetFolder);

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Success,
                movedItem.ResponseClass,
                "Server should return success for moving the meeting item.");

            ItemIdType movedMeetingItemId = movedItem.Items.Items[0].ItemId;
            #endregion

            #region Organizer calls FindItem to verify the meeting item is moved to Inbox folder
            CalendarItemType calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The meeting item should be moved into organizer's Inbox folder.");
            #endregion

            #region Attendee finds the meeting request message in his Inbox folder
            MeetingRequestMessageType request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType;
            Site.Assert.IsNotNull(request, "The meeting request message should exist in attendee's inbox folder.");
            #endregion

            #region Attendee moves the meeting request message to the Calendar folder
            movedItem = this.MoveSingleCalendarItem(Role.Attendee, request.ItemId, msgTargetFolder);

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Success,
                movedItem.ResponseClass,
                @"Server should return success for moving meeting request message.");
            #endregion

            #region Attendee calls FindItem to verify the meeting request message is moved to Calendar folder
            request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.calendar, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType;
            Site.Assert.IsNotNull(request, "The meeting request message should exist in attendee's calendar folder.");
            #endregion

            #region Attendee calls CreateItem to accept the meeting request with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            AcceptItemType acceptItem = new AcceptItemType();
            acceptItem.ReferenceItemId = request.ItemId;

            item = this.CreateSingleCalendarItem(Role.Attendee, acceptItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            #endregion

            #region Organizer finds the meeting response message in its Inbox folder
            MeetingResponseMessageType response = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Resp", meetingItem.UID) as MeetingResponseMessageType;
            Site.Assert.IsNotNull(response, "The meeting response message should exist in organizer's inbox folder.");
            #endregion

            #region Organizer moves the meeting response message to his Calendar folder
            movedItem = this.MoveSingleCalendarItem(Role.Organizer, response.ItemId, msgTargetFolder);

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Success,
                movedItem.ResponseClass,
                "EWS should return success for moving the meeting response message.");
            #endregion

            #region Organizer calls FindItem to verify the meeting response message is moved to Calendar folder
            response = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Schedule.Meeting.Resp", meetingItem.UID) as MeetingResponseMessageType;
            Site.Assert.IsNotNull(response, "The meeting response message should be in organizer's calendar folder.");
            #endregion

            #region Organizer calls DeleteItem to delete the meeting with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            ResponseMessageType deletedItem = this.DeleteSingleCalendarItem(Role.Organizer, movedMeetingItemId, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(deletedItem, "Delete the meeting should be successful.");
            #endregion

            #region Attendee finds the meeting cancellation message in his Inbox folder
            MeetingCancellationMessageType canceledMeeting = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Canceled", meetingItem.UID) as MeetingCancellationMessageType;
            Site.Assert.IsNotNull(canceledMeeting, "The meeting cancellation message should be in attendee's inbox folder.");
            #endregion

            #region Attendee moves the meeting cancellation message to his Calendar folder
            movedItem = this.MoveSingleCalendarItem(Role.Attendee, canceledMeeting.ItemId, msgTargetFolder);

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Success,
                movedItem.ResponseClass,
                "EWS should return success for moving the meeting cancellation message.");
            #endregion

            #region Attendee calls FindItem to verify the meeting cancellation message is moved to Calendar folder
            canceledMeeting = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.calendar, "IPM.Schedule.Meeting.Canceled", meetingItem.UID) as MeetingCancellationMessageType;
            Site.Assert.IsNotNull(canceledMeeting, "The meeting cancellation message should be in attendee's calendar folder.");
            #endregion

            #region Attendee removes the meeting item
            RemoveItemType removeItem = new RemoveItemType();
            removeItem.ReferenceItemId = canceledMeeting.ItemId;
            item = this.CreateSingleCalendarItem(Role.Attendee, removeItem, CalendarItemCreateOrDeleteOperationType.SendToNone);
            Site.Assert.IsNotNull(item, "The meeting item should be removed.");
            #endregion

            #region Clean up organizer's calendar and deleteditems folders, and attendee's sentitems and deleteditems folders
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.deleteditems
            });
            this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems
            });
            #endregion
        }
Beispiel #25
0
        public void MSOXWSMTGS_S03_TC02_CopySingleMeetingItem()
        {
            #region Organizer creates a single meeting getItem with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.Subject           = this.Subject;
            meetingItem.UID               = Guid.NewGuid().ToString();
            meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };
            meetingItem.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.OrganizerEmailAddress) };
            meetingItem.Resources         = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) };

            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(item, "Create single meeting item should be successful.");
            #endregion

            #region Organizer copies the created single meeting item to Drafts folder
            CalendarItemType calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The created calendar should exist in organizer's calendar folder.");
            ItemIdType itemId = calendar.ItemId;

            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.drafts;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            ItemInfoResponseMessageType copiedItem = this.CopySingleCalendarItem(Role.Organizer, itemId, targetFolderId);
            Site.Assert.IsNotNull(copiedItem, @"Copy the single meeting item should be successful.");
            #endregion

            #region Organizer calls GetItem operation to verify whether the meeting item is really copied
            calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.drafts, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The copied calendar should exist in organizer's Drafts folder.");
            #endregion

            #region Attendee gets the meeting request message in the Inbox folder
            MeetingRequestMessageType request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, meetingItem.Subject, meetingItem.UID, UnindexedFieldURIType.itemSubject) as MeetingRequestMessageType;
            Site.Assert.IsNotNull(request, "The meeting request message should exist in attendee's inbox folder.");
            #endregion

            #region Attendee copies the meeting request message to the Drafts folder
            copiedItem = this.CopySingleCalendarItem(Role.Attendee, request.ItemId, targetFolderId);
            Site.Assert.IsNotNull(copiedItem, @"Copy the single meeting request message should be successful.");
            #endregion

            #region Attendee calls CreateItem to accept the meeting request with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            AcceptItemType acceptItem = new AcceptItemType();
            acceptItem.ReferenceItemId = request.ItemId;

            Site.Assert.IsNotNull(
                this.CreateSingleCalendarItem(Role.Attendee, acceptItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll),
                "Attendee creates items for meeting request should succeed.");
            #endregion

            #region Organizer finds the meeting response message in his Inbox folder and copies it to the Drafts folder
            MeetingResponseMessageType response = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Resp", meetingItem.UID) as MeetingResponseMessageType;
            Site.Assert.IsNotNull(response, "The response message from Attendee should be in organizer's Inbox folder.");

            copiedItem = this.CopySingleCalendarItem(Role.Organizer, response.ItemId, targetFolderId);
            Site.Assert.IsNotNull(copiedItem, @"Copy the single meeting response message should be successful.");
            #endregion

            #region Organizer deletes the meeting item with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            ResponseMessageType deletedItem = this.DeleteSingleCalendarItem(Role.Organizer, itemId, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(deletedItem, @"Delete the single meeting item should be successful.");
            #endregion

            #region Attendee finds the meeting cancellation message in the Inbox folder and copies it to the Drafts folder
            int upperBound = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
            int waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int count      = 1;

            MeetingCancellationMessageType canceledItem = null;

            while (canceledItem == null && count++ <= upperBound)
            {
                canceledItem = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Canceled", meetingItem.UID) as MeetingCancellationMessageType;
                System.Threading.Thread.Sleep(waitTime);
            }

            Site.Assert.IsNotNull(canceledItem, "The cancellation meeting message should be in attendee's Inbox folder.");

            ItemIdType canceledItemId = canceledItem.ItemId;
            copiedItem = this.CopySingleCalendarItem(Role.Attendee, canceledItemId, targetFolderId);
            Site.Assert.IsNotNull(copiedItem, "Attendee should copy the meeting cancellation message to the Drafts folder.");
            #endregion

            #region Clean up inbox, drafts and deleteditems folders of both organizer and attendee. Attendee's sentitems and calendar should also be cleaned up.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.drafts, DistinguishedFolderIdNameType.deleteditems
            });
            this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.drafts, DistinguishedFolderIdNameType.deleteditems
            });
            #endregion
        }
Beispiel #26
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
        }
        public void MSOXWSMTGS_S05_TC01_GetMultipleCalendarItems()
        {
            #region Define multiple calendar items
            int timeInterval = this.TimeInterval;
            CalendarItemType calendarItem1 = new CalendarItemType();
            calendarItem1.UID     = Guid.NewGuid().ToString();
            calendarItem1.Subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
            calendarItem1.Start   = DateTime.Now.AddHours(timeInterval);

            // Indicate the Start property is serialized in the SOAP message.
            calendarItem1.StartSpecified = true;
            timeInterval++;
            calendarItem1.End                           = DateTime.Now.AddHours(timeInterval);
            calendarItem1.EndSpecified                  = true;
            calendarItem1.LegacyFreeBusyStatus          = this.LegacyFreeBusy;
            calendarItem1.LegacyFreeBusyStatusSpecified = true;
            calendarItem1.Location                      = this.Location;
            calendarItem1.When                          = string.Format("{0} to {1}", calendarItem1.Start.ToString(), calendarItem1.End.ToString());

            CalendarItemType calendarItem2 = new CalendarItemType();
            calendarItem2.UID     = Guid.NewGuid().ToString();
            calendarItem2.Subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
            timeInterval          = this.TimeInterval;
            calendarItem2.Start   = calendarItem1.End.AddHours(timeInterval);
            timeInterval++;
            calendarItem2.StartSpecified                = true;
            calendarItem2.End                           = calendarItem1.End.AddHours(timeInterval);
            calendarItem2.EndSpecified                  = true;
            calendarItem2.LegacyFreeBusyStatus          = this.LegacyFreeBusy;
            calendarItem2.LegacyFreeBusyStatusSpecified = true;
            calendarItem2.Location                      = this.Location;
            calendarItem2.When                          = string.Format("{0} to {1}", calendarItem1.Start.ToString(), calendarItem1.End.ToString());
            #endregion

            #region Create multiple calendar items
            ItemInfoResponseMessageType[] calendars = this.CreateMultipleCalendarItems(Role.Organizer, new ItemType[] { calendarItem1, calendarItem2 }, CalendarItemCreateOrDeleteOperationType.SendToNone);
            Site.Assert.IsNotNull(calendars, "The calendars should be created successfully.");
            Site.Assert.IsTrue(calendars.Length == 2, "There should be only two calendars created.");

            ItemIdType[] calendarIds = new ItemIdType[] { calendars[0].Items.Items[0].ItemId, calendars[1].Items.Items[0].ItemId };
            #endregion

            #region Get multiple calendar items
            ItemInfoResponseMessageType[] getItems = this.GetMultipleCalendarItems(Role.Organizer, calendarIds);
            Site.Assert.IsNotNull(getItems, "The calendars should be gotten successfully.");
            Site.Assert.IsTrue(getItems.Length == 2, "There should be only two calendars returned by GetItem.");
            #endregion

            #region Delete multiple calendar items
            Site.Assert.IsNotNull(
                this.DeleteMultipleCalendarItems(Role.Organizer, calendarIds, CalendarItemCreateOrDeleteOperationType.SendToNone),
                "Organizer should delete multiple calendar items successfully.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1207
            // This requirement can be captured after above assert.
            Site.CaptureRequirement(
                1207,
                @"[In Messages] A successful DeleteItem operation returns a DeleteItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.3.2.2, with the ResponseClass attribute of the DeleteItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"".");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1208
            // This requirement can be captured after above assert.
            Site.CaptureRequirement(
                1208,
                @"[In Messages] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.43, of the DeleteItemResponseMessage element is set to ""NoError"".");
            #endregion
        }
        public void MSOXWSFOLD_S04_TC07_UnReadCount()
        {
            #region Get the Inbox folder

            DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
            folder.Id = DistinguishedFolderIdNameType.inbox;

            // GetFolder request.
            GetFolderType getInboxRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder);

            // Get the Inbox folder.
            GetFolderResponseType getInboxResponse = this.FOLDAdapter.GetFolder(getInboxRequest);

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

            // Variable to save the folder.
            FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getInboxResponse.ResponseMessages.Items[0];
            BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0];

            // Variable to save the count of unread messages before sent mail to the specific account.
            // Save the unread message count.
            int count = ((FolderType)folderInfo).UnreadCount;

            #endregion

            #region Create an unread message.

            string itemName = Common.GenerateResourceName(this.Site, "Test Mail");

            // Send a mail to User1
            ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), DistinguishedFolderIdNameType.inbox.ToString(), itemName);
            this.NewCreatedItemIds.Add(itemId);

            #endregion

            #region Get the Inbox folder

            // Set the request's folderId field.
            folder.Id = DistinguishedFolderIdNameType.inbox;

            // GetFolder request.
            GetFolderType getInboxAfterMailReceivedRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder);

            // Get the Inbox folder.
            GetFolderResponseType getInboxAfterMailReceivedResponse = this.FOLDAdapter.GetFolder(getInboxAfterMailReceivedRequest);

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

            // Variable to save the folder.
            allFolders = (FolderInfoResponseMessageType)getInboxAfterMailReceivedResponse.ResponseMessages.Items[0];
            folderInfo = (BaseFolderType)allFolders.Folders[0];
            FolderType folderType = (FolderType)folderInfo;
            #endregion

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R99
            // Unread count value is returned from server, and schema is verified in adapter so this requirement can be covered.
            this.Site.CaptureRequirementIfIsNotNull(
                folderType.UnreadCount,
                99,
                @"[In t:FolderType Complex Type]The type of element UnreadCount is xs:int [XMLSCHEMA2].");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R10010
            // After sending a new message to mail box, the number of unread messages should be (count + 1).
            this.Site.CaptureRequirementIfAreEqual <int>(
                1 + count,
                folderType.UnreadCount,
                10010,
                @"[In t:FolderType Complex Type]This element[UnreadCount] MUST exist in responses.");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9901
            this.Site.CaptureRequirementIfAreEqual <int>(
                1 + count,
                folderType.UnreadCount,
                9901,
                @"[In t:FolderType Complex Type]UnreadCount specifies the number of unread items in a folder.");

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

            // Since R9901 and R100 are captured successfully, this requirement will be captured.
            this.Site.CaptureRequirement(
                10011,
                @"[In t:FolderType Complex Type]This element[UnreadCount] MUST equal the sum of all MessageType complex types ([MS-OXWSMSG] section 2.2.4.3) and PostItemType complex types ([MS-OXWSPOST] section 2.2.4.1) that have the IsRead property set to ""false"".");
        }
Beispiel #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
        }
Beispiel #30
0
        public void MSOXWSMTGS_S03_TC03_CopyRecurringCalendar()
        {
            #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 Get the targeted occurrence item
            ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Organizer, occurrenceItemId);
            Site.Assert.IsNotNull(getItem, @"Get the occurrence should be successful.");

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

            #region Copy the recurring calendar item to Drafts folder through Id of recurring master getItem
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.drafts;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            ItemInfoResponseMessageType copiedItem = this.CopySingleCalendarItem(Role.Organizer, recurringMasterItemId, targetFolderId);
            Site.Assert.IsNotNull(copiedItem, @"Copy recurring calendar item through RecurringMasterItemId should be successful.");
            ItemIdType calendarIdByCopied = copiedItem.Items.Items[0].ItemId;
            #endregion

            #region Call GetItem operation to verify whether the recurring calendar item is really copied
            getItem = this.GetSingleCalendarItem(Role.Organizer, calendarIdByCopied);

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R806
                this.Site.CaptureRequirementIfIsNotNull(
                    getItem,
                    806,
                    @"[In Appendix C: Product Behavior] CopyItemSoapIn: For each item being copied that is a recurring calendar item, implementation does contain a RecurringMasterItemId child element ([MS-OXWSCORE] section 2.2.4.11). (Exchange 2007 and above follow this behavior.)");
            }
            #endregion

            #region Clean up organizer's drafts and calendar folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.drafts
            });
            #endregion
        }