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
        }
Exemplo n.º 2
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
        }
        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
        }
        /// <summary>
        /// Log on to a mailbox with a specified user account and create a search folder.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="userPassword">Password of the user.</param>
        /// <param name="userDomain">Domain of the user.</param>
        /// <param name="searchFolderName">Name of the search folder.</param>
        /// <param name="searchText">Search text of the search folder.</param>
        /// <returns>If the search folder is created successfully, return true; otherwise, return false.</returns>
        public bool CreateSearchFolder(string userName, string userPassword, string userDomain, string searchFolderName, string searchText)
        {
            // Log on mailbox with specified user account(userName, userPassword, userDomain).
            bool isLoged = AdapterHelper.SwitchUser(userName, userPassword, userDomain, this.exchangeServiceBinding, this.Site);

            Site.Assert.IsTrue(
                isLoged,
                string.Format("Log on mailbox with the UserName: {0}, Password: {1}, Domain: {2} should be successful.", userName, userPassword, userDomain));

            // Create the request.
            CreateFolderType createFolder = new CreateFolderType();

            SearchFolderType[] folderArray  = new SearchFolderType[1];
            SearchFolderType   searchFolder = new SearchFolderType();

            // Use the following search filter to get all mail in the Inbox with the word searchText in the subject line.
            searchFolder.SearchParameters                    = new SearchParametersType();
            searchFolder.SearchParameters.Traversal          = SearchFolderTraversalType.Deep;
            searchFolder.SearchParameters.TraversalSpecified = true;
            searchFolder.SearchParameters.BaseFolderIds      = new DistinguishedFolderIdType[4];

            // Create a distinguished folder Identified of the inbox folder.
            DistinguishedFolderIdType inboxFolder = new DistinguishedFolderIdType();

            inboxFolder.Id = new DistinguishedFolderIdNameType();
            inboxFolder.Id = DistinguishedFolderIdNameType.inbox;
            searchFolder.SearchParameters.BaseFolderIds[0] = inboxFolder;
            DistinguishedFolderIdType contactType = new DistinguishedFolderIdType();

            contactType.Id = new DistinguishedFolderIdNameType();
            contactType.Id = DistinguishedFolderIdNameType.contacts;
            searchFolder.SearchParameters.BaseFolderIds[1] = contactType;
            DistinguishedFolderIdType calendarType = new DistinguishedFolderIdType();

            calendarType.Id = new DistinguishedFolderIdNameType();
            calendarType.Id = DistinguishedFolderIdNameType.calendar;
            searchFolder.SearchParameters.BaseFolderIds[2] = calendarType;
            DistinguishedFolderIdType taskType = new DistinguishedFolderIdType();

            taskType.Id = new DistinguishedFolderIdNameType();
            taskType.Id = DistinguishedFolderIdNameType.calendar;
            searchFolder.SearchParameters.BaseFolderIds[3] = taskType;

            // Use the following search filter.
            searchFolder.SearchParameters.Restriction = new RestrictionType();
            PathToUnindexedFieldType path = new PathToUnindexedFieldType();

            path.FieldURI = UnindexedFieldURIType.itemSubject;
            RestrictionType        restriction        = new RestrictionType();
            FieldURIOrConstantType fieldURIORConstant = new FieldURIOrConstantType();

            fieldURIORConstant.Item = new ConstantValueType();
            (fieldURIORConstant.Item as ConstantValueType).Value = searchText;
            ExistsType isEqual = new ExistsType();

            isEqual.Item     = path;
            restriction.Item = isEqual;
            searchFolder.SearchParameters.Restriction = restriction;

            // Give the search folder a unique name.
            searchFolder.DisplayName = searchFolderName;
            folderArray[0]           = searchFolder;

            // Create the search folder under the default Search Folder.
            TargetFolderIdType        targetFolder  = new TargetFolderIdType();
            DistinguishedFolderIdType searchFolders = new DistinguishedFolderIdType();

            searchFolders.Id            = DistinguishedFolderIdNameType.searchfolders;
            targetFolder.Item           = searchFolders;
            createFolder.ParentFolderId = targetFolder;
            createFolder.Folders        = folderArray;
            bool isSearchFolderCreated = false;

            // Invoke CreateFolder operation and get the response.
            CreateFolderResponseType response = this.exchangeServiceBinding.CreateFolder(createFolder);

            if (response != null && ResponseClassType.Success == response.ResponseMessages.Items[0].ResponseClass)
            {
                // If the search folder is created successfully, return true; otherwise, return false.
                isSearchFolderCreated = true;

                searchFolder.FolderId = ((FolderInfoResponseMessageType)response.ResponseMessages.Items[0]).Folders[0].FolderId;
                AdapterHelper.CreatedFolders.Add(searchFolder);
            }

            return(isSearchFolderCreated);
        }
        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
        }
        public void MSOXWSMTGS_S04_TC05_MoveItemErrorCalendarCannotUseIdForOccurrenceId()
        {
            #region Define a meeting
            int timeInterval             = this.TimeInterval;
            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.UID     = Guid.NewGuid().ToString();
            meetingItem.Subject = this.Subject;
            meetingItem.Start   = DateTime.UtcNow;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            #region Clean up organizer's calendar, sentitems and deleteditems folders and attendee's calendar, inbox and deleteditems folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType> {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems
            });
            this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.deleteditems
            });
            #endregion
        }
        public void MSOXWSMTGS_S04_TC04_MoveItemErrorCalendarCannotMoveOrCopyOccurrence()
        {
            #region Define a recurring calendar item
            DateTime startTime = DateTime.Now;

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

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

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

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

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

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

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

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

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

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

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

            #region Clean up organizer's calendar folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar
            });
            #endregion
        }
        public void MSOXWSMTGS_S04_TC03_MoveRecurringCalendar()
        {
            #region Define a recurring calendar item to move
            DateTime startTime = DateTime.Now;

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

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

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

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

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

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

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

            ItemInfoResponseMessageType movedItem = this.MoveSingleCalendarItem(Role.Organizer, recurringMasterItemId, targetFolderId);
            Site.Assert.IsNotNull(movedItem, @"Server should return success for moving the recurring calendar item.");
            #endregion

            #region Call FindItem to verify the recurring 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 recurring calendar should be in organizer's inbox folder.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R808
                this.Site.CaptureRequirementIfAreEqual <CalendarItemTypeType>(
                    CalendarItemTypeType.RecurringMaster,
                    calendar.CalendarItemType1,
                    808,
                    @"[In Appendix C: Product Behavior] MoveItemSoapIn: For each item being moved 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 inbox folder.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.inbox
            });
            #endregion
        }
Exemplo n.º 9
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
        }
Exemplo n.º 10
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
        }
Exemplo n.º 11
0
        /// <summary>
        /// Sends mail through the exchange server.
        /// </summary>
        /// <param name="Config"> ReviewNotifierConfiguration. </param>
        /// <param name="ExchangeItems"> Mail to send. </param>
        /// <returns> true if successful. </returns>
        private static bool SendExchangeMail(ReviewNotifierConfiguration Config, List<MessageType> ExchangeItems)
        {
            int maxQuotaNum = Int32.MaxValue;
            var binding = (ExchangeServicePortType)new ExchangeServicePortTypeClient(
                                                       new BasicHttpBinding("ExchangeServiceBinding")
                                                       {
                                                           MaxReceivedMessageSize = maxQuotaNum,
                                                           MaxBufferSize = maxQuotaNum,
                                                           ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
                                                           {
                                                               MaxArrayLength = maxQuotaNum,
                                                               MaxStringContentLength = maxQuotaNum,
                                                               MaxNameTableCharCount = maxQuotaNum
                                                           }
                                                       },
                                                       new EndpointAddress(Config.EmailService));

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

            TargetFolderIdType targetFolder = new TargetFolderIdType();
            targetFolder.Item = folder;

            CreateItemType createItem = new CreateItemType();
            createItem.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
            createItem.MessageDispositionSpecified = true;
            createItem.SavedItemFolderId = targetFolder;

            createItem.Items = new NonEmptyArrayOfAllItemsType();
            createItem.Items.Items = ExchangeItems.ToArray();

            var createReq = new CreateItemRequest() { CreateItem = createItem };

            var response = binding.CreateItem(createReq);

            bool result = true;
            foreach (ResponseMessageType r in response.CreateItemResponse1.ResponseMessages.Items)
            {
                if (r.ResponseClass != ResponseClassType.Success)
                {
                    Log.Info("Failed to send the message. ");
                    Log.Info(r.MessageText);

                    result = false;
                }
            }

            return result;
        }
Exemplo n.º 12
0
    static void MoveFolder(ExchangeServiceBinding esb, FolderIdType sourceFolderID, FolderIdType destinationFolderID)
    {
        MoveFolderType moveFolder = new MoveFolderType();
        moveFolder.FolderIds = new FolderIdType[] { sourceFolderID };
        TargetFolderIdType targetID = new TargetFolderIdType();
        targetID.Item = destinationFolderID;
        moveFolder.ToFolderId = targetID;

        try
        {
            // Send the request and get the response
            MoveFolderResponseType response = esb.MoveFolder(moveFolder);

            // Get the response messages
            ResponseMessageType[] rmta = response.ResponseMessages.Items;

        }
        catch (Exception e)
        {
            string problem = e.Message;
        }
    }
Exemplo n.º 13
0
    static void CreateFolder(ExchangeServiceBinding esb, FolderIdType fiFolderID, String fnFldName)
    {
        // Create the request
        FolderType folder = new FolderType();
        folder.DisplayName = fnFldName;

        TargetFolderIdType targetID = new TargetFolderIdType();
        targetID.Item = fiFolderID;

        CreateFolderType createFolder = new CreateFolderType();
        createFolder.Folders = new FolderType[] { folder };
        createFolder.ParentFolderId = targetID;

        try
        {
            // Send the request and get the response
            CreateFolderResponseType response = esb.CreateFolder(createFolder);

            // Get the response messages
            ResponseMessageType[] rmta = response.ResponseMessages.Items;

        }
        catch (Exception e)
        {
            string problem = e.Message;
        }
    }
        public void MSOXWSMTGS_S03_TC05_CopyItemErrorCalendarCannotUseIdForRecurringMasterId()
        {
            #region Define a meeting
            int timeInterval = this.TimeInterval;
            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID     = Guid.NewGuid().ToString();
            calendarItem.Subject = this.Subject;
            calendarItem.Start   = DateTime.UtcNow;

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

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

            ItemInfoResponseMessageType item1 = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy);
            Site.Assert.IsNotNull(item1, "Server should return success for creating a recurring meeting.");

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

            #endregion

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

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

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

            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.UID               = Guid.NewGuid().ToString();
            meetingItem.Subject           = this.Subject;
            meetingItem.Start             = startTime;
            meetingItem.StartSpecified    = true;
            meetingItem.End               = startTime.AddHours(this.TimeInterval);
            meetingItem.EndSpecified      = true;
            meetingItem.Location          = this.Location;
            meetingItem.Recurrence        = new RecurrenceType();
            meetingItem.Recurrence.Item   = pattern;
            meetingItem.Recurrence.Item1  = range;
            meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };
            meetingItem.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.OrganizerEmailAddress) };
            meetingItem.Resources         = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) };
            #endregion

            #region Organizer creates a recurring calendar item with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            CreateItemType createItemRequest = new CreateItemType();
            createItemRequest.Items       = new NonEmptyArrayOfAllItemsType();
            createItemRequest.Items.Items = new ItemType[] { meetingItem };
            createItemRequest.MessageDispositionSpecified     = true;
            createItemRequest.MessageDisposition              = MessageDispositionType.SaveOnly;
            createItemRequest.SendMeetingInvitationsSpecified = true;
            createItemRequest.SendMeetingInvitations          = CalendarItemCreateOrDeleteOperationType.SendToNone;

            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            #endregion

            #region Organizer copys the RecurringMasterId of the recurring calendar item

            #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;
            OccurrenceItemIdType occurrenceId = new OccurrenceItemIdType();
            occurrenceId.RecurringMasterId = calendarInOrganizer.ItemId.Id;
            occurrenceId.InstanceIndex     = 1;

            CopyItemType copyItemRequest = new CopyItemType();
            copyItemRequest.ItemIds    = new BaseItemIdType[] { occurrenceId };
            copyItemRequest.ToFolderId = targetFolderId;
            CopyItemResponseType response = this.MTGSAdapter.CopyItem(copyItemRequest);

            #endregion

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

            //Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1223
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorCalendarCannotUseIdForRecurringMasterId,
                response.ResponseMessages.Items[0].ResponseCode,
                1223,
                @"[In Messages] ErrorCalendarCannotUseIdForRecurringMasterId: Specifies that the RecurringMasterId ([MS-OXWSCORE] section 2.2.4.35) does not correspond to a valid recurring master item.");
            #endregion

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