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_S01_TC02_CreateAndAcceptMeeting()
        {
            #region Define a meeting to be created
            int timeInterval = this.TimeInterval;
            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.UID = Guid.NewGuid().ToString();
            meetingItem.Subject = this.Subject;
            meetingItem.Start = DateTime.Now.AddHours(timeInterval);

            // Indicates the Start property is serialized in the SOAP message.
            meetingItem.StartSpecified = true;
            timeInterval++;
            meetingItem.End = DateTime.Now.AddHours(timeInterval);
            meetingItem.EndSpecified = true;
            meetingItem.Location = this.Location;
            meetingItem.When = string.Format("{0} to {1}", meetingItem.Start.ToString(), meetingItem.End.ToString());
            meetingItem.IsAllDayEvent = true;
            meetingItem.IsAllDayEventSpecified = true;
            meetingItem.IsResponseRequested = true;
            meetingItem.IsResponseRequestedSpecified = true;
            meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };
            meetingItem.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) };
            if (Common.IsRequirementEnabled(2301, this.Site))
            {
                meetingItem.IsOnlineMeeting = true;
                meetingItem.IsOnlineMeetingSpecified = true;
            }
			
            meetingItem.AllowNewTimeProposal = true;
            meetingItem.AllowNewTimeProposalSpecified = true;
            meetingItem.ConferenceType = 1;
            meetingItem.ConferenceTypeSpecified = true;
            meetingItem.MeetingWorkspaceUrl = this.MeetingWorkspace;
            meetingItem.NetShowUrl = this.NetShowLocation;
            meetingItem.LegacyFreeBusyStatus = LegacyFreeBusyType.Tentative;
            meetingItem.LegacyFreeBusyStatusSpecified = true;
            #endregion

            #region Organizer creates a meeting with CalendarItemCreateOrDeleteOperationType value set to SendToAllAndSaveCopy
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy);
            Site.Assert.IsNotNull(item, "The meeting should be created successfully.");

            Site.Assert.IsNotNull(
                this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.sentitems, "IPM.Schedule.Meeting.Request", meetingItem.UID),
                "The meeting request message should be saved to organizer's Sent Items folder after call CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy.");

            ItemIdType meetingId = item.Items.Items[0].ItemId;

            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.");

            if (Common.IsRequirementEnabled(1282, this.Site))
            {
                Site.Assert.IsTrue(calendarInOrganizer.RequiredAttendees[0].ResponseTypeSpecified, "Element ResponseType should be present.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R79
                this.Site.CaptureRequirementIfAreEqual<ResponseTypeType>(
                    ResponseTypeType.Unknown,
                    calendarInOrganizer.RequiredAttendees[0].ResponseType,
                    79,
                    @"[In t:ResponseTypeType Simple Type] Unknown: Indicates that the recipient's response to the meeting is unknown.");
            }
            #endregion

            #region Organizer gets the created meeting
            MeetingRequestMessageType meetingRequest = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.sentitems, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType;
            Site.Assert.IsNotNull(meetingRequest, "The meeting request message should be found in organizer's Sent Items folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R317
            this.Site.CaptureRequirementIfAreEqual<string>(
                this.RoomEmailAddress.ToLower(),
                meetingRequest.OptionalAttendees[0].Mailbox.EmailAddress.ToLower(),
                317,
                @"[In t:MeetingRequestMessageType Complex Type] OptionalAttendees: Represents attendees who are not required to attend the meeting.");
            #endregion

            #region Attendee gets the meeting request message in the inbox and calendar folders respectively
            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 be found in attendee's Inbox folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy.");

            #region Capture Code

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

            // Verify MS-OXWSCORE requirement: MS-OXWSMTGS_R299
            this.Site.CaptureRequirementIfIsNull(
                request.When,
                299,
                @"[In t:MeetingRequestMessageType Complex Type] When: Provides information about when the meeting occurs and is not populated to attendee's mailbox.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSMTGS_R319
            this.Site.CaptureRequirementIfIsNull(
                request.Resources,
                319,
                @"[In t:MeetingRequestMessageType Complex Type] Resources: Represents a scheduled resource for the meeting and is not populated to attendee's mailbox.");

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

                // Verify MS-OXWSCORE requirement: MS-OXWSMTGS_R1282
                this.Site.CaptureRequirementIfIsTrue(
                    request.ResponseTypeSpecified,
                    1282,
                    @"[In Appendix C: Product Behavior] Implementation does support ResponseType if the recipient has not yet responded to the meeting request. (Exchange 2007, Exchange 2013 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(1292, this.Site))
            {
                foreach (ResponseObjectType responseObject in request.ResponseObjects)
                {
                    if (responseObject.GetType() == typeof(ProposeNewTimeType))
                    {
                        // Add the debug information
                        this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1292");

                        // Verify MS-OXWSCORE requirement: MS-OXWSMTGS_R1292
                        // Element ProposeNewTime is returned from server, this requirement can be captured directly.
                        this.Site.CaptureRequirement(
                            1292,
                            @"[In Appendix C: Product Behavior] Implementation does support the ProposeNewTimeType which specifies a response to a new time proposal. (This type was introduced in Exchange 2013 SP1.)");

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

                        // Verify MS-OXWSCORE requirement: MS-OXWSMTGS_R1107
                        // Element ProposeNewTime is returned from server and passes schema validation, this requirement can be captured directly.
                        this.Site.CaptureRequirement(
                            1107,
                            @"[In t:ProposeNewTimeType Complex Type] This type [ProposeNewTimeType] extends the ResponseObjectType complex type ([MS-OXWSCDATA] section 2.2.4.65).");

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

                        // Verify MS-OXWSCORE requirement: MS-OXWSMTGS_R1355
                        // Element ProposeNewTime is returned from server and passes schema validation, this requirement can be captured directly.
                        this.Site.CaptureRequirement(
                            1355,
                            @"[In t:ProposeNewTimeType Complex Type] [its schema is] <xs:complexType name=""ProposeNewTimeType"">
                          <xs:complexContent>
                              <xs:extension base=""t:ResponseObjectType""/>
                              </xs:complexContent>
                          </xs:complexType>");
                        break;
                    }
                }
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R488
            this.Site.CaptureRequirementIfAreEqual<string>(
                "IPM.Schedule.Meeting.Request",
                request.ItemClass,
                488,
                "[In CreateItem Operation] This operation [CreateItem] can be used to create meeting request messages.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R28504
            this.Site.CaptureRequirementIfAreEqual<LegacyFreeBusyType>(
                LegacyFreeBusyType.Tentative,
                request.IntendedFreeBusyStatus,
                28504,
                @"[In t:MeetingRequestMessageType Complex Type] The IntendedFreeBusyStatus which value is ""Tentative"" specifies the status as tentative.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R35501
                this.Site.CaptureRequirementIfAreEqual<int>(
                    meetingItem.ConferenceType,
                    request.ConferenceType,
                    35501,
                    @"[In t:MeetingRequestMessageType Complex Type] The value of ""ConferenceType"" is ""1"" describes the type of conferencing is presentation");
            }
            #endregion

            AcceptItemType acceptItem = new AcceptItemType();
            acceptItem.ReferenceItemId = new ItemIdType();
            acceptItem.ReferenceItemId.Id = request.ItemId.Id;
            if (Common.IsRequirementEnabled(1284, this.Site))
            {
                acceptItem.ProposedStart = DateTime.Now;
                acceptItem.ProposedStartSpecified = true;
                acceptItem.ProposedEnd = DateTime.Now.AddHours(1);
                acceptItem.ProposedEndSpecified = true;
            }

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

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R16504
            this.Site.CaptureRequirementIfAreEqual<LegacyFreeBusyType>(
                LegacyFreeBusyType.Tentative,
                calendar.LegacyFreeBusyStatus,
                16504,
                @"[In t:CalendarItemType Complex Type] The LegacyFreeBusyStatus which value is ""Tentative"" specifies the status as tentative.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1047
            this.Site.CaptureRequirementIfIsNull(
                calendar.When,
                1047,
                @"[In t:CalendarItemType Complex Type] [When] is not populated to attendee's mailbox.");

            if (Common.IsRequirementEnabled(1282, this.Site))
            {
                Site.Assert.IsTrue(calendar.MyResponseTypeSpecified, "Element MyResponseType should be present.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "VerifyMS-OXWSMTGS_R84");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R84
                this.Site.CaptureRequirementIfAreEqual<ResponseTypeType>(
                    ResponseTypeType.NoResponseReceived,
                    calendar.MyResponseType,
                    84,
                    @"[In t:ResponseTypeType Simple Type] NoResponseReceived: Indicates that the recipient has not yet responded to the meeting request.");
            }
            #endregion

            #region Attendee calls CreateItem to accept the meeting request with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            item = this.CreateSingleCalendarItem(Role.Attendee, acceptItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(item, "Accept the meeting request should be successful.");
            #endregion

            #region Organizer gets the meeting response message in the 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 from Attendee should be existed.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R489
            this.Site.CaptureRequirementIfAreEqual<string>(
                "IPM.Schedule.Meeting.Resp.Pos",
                response.ItemClass,
                489,
                "[In CreateItem Operation] This operation [CreateItem] can be used to create meeting response messages.");
            #endregion

            #region Organizer gets the calendar in the Calendar folder
            calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType;

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R139
            this.Site.CaptureRequirementIfAreEqual<ResponseTypeType>(
                ResponseTypeType.Accept,
                calendar.RequiredAttendees[0].ResponseType,
                139,
                "[In t:AttendeeType Complex Type]ResponseType: Specifies the meeting invitation response received for by the meeting organizer from a meeting attendee.");
            
            if (Common.IsRequirementEnabled(1334, this.Site))
            {
                this.Site.Assert.IsTrue(calendar.RequiredAttendees[0].ProposedStartSpecified, "ProposedStart element in AttendeeType should be returned.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1334
                this.Site.CaptureRequirementIfAreEqual<string>(
                    acceptItem.ProposedStart.ToString(),
                    calendar.RequiredAttendees[0].ProposedStart.ToString(),
                    1334,
                    "[In Appendix C: Product Behavior] Implementation does support the ProposedStart element which specifies the proposed start date and time of the meeting. (This type was introduced in Exchange 2013 SP1.)");
            }

            if (Common.IsRequirementEnabled(1336, this.Site))
            {
                this.Site.Assert.IsTrue(calendar.RequiredAttendees[0].ProposedEndSpecified, "ProposedEnd element in AttendeeType should be returned.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1336
                this.Site.CaptureRequirementIfAreEqual<string>(
                    acceptItem.ProposedEnd.ToString(),
                    calendar.RequiredAttendees[0].ProposedEnd.ToString(),
                    1336,
                    "[In Appendix C: Product Behavior] Implementation does support the ProposedEnd element which specifies the proposed end date and time of the meeting. (This type was introduced in Exchange 2013 SP1.)");
            }

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1284
                // Elements in MeetingRegistrationResponseObjectType are set in request and the operation calls successfully,
                // so this requirement can be captured directly.
                this.Site.CaptureRequirement(
                    1284,
                    "[In Appendix C: Product Behavior] Implementation does support the MeetingRegistrationResponseObjectType complex type which specifies a response to a meeting registration request. (This type was introduced in Exchange 2013 SP1.)");
            }

            request = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.sentitems, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType;
            Site.Assert.IsTrue(request.IsDelegatedSpecified, "Element IsDelegated should be present.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R749
            this.Site.CaptureRequirementIfIsFalse(
                request.IsDelegated,
                749,
                "[In t:MeetingMessageType Complex Type]otherwise [if a meeting was not handled by an account that has delegate access], [IsDelegated is] false.");
            #endregion

            #region Organizer deletes the meeting with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll
            ResponseMessageType deletedItem = this.DeleteSingleCalendarItem(Role.Organizer, meetingId, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(deletedItem, "Organizer should delete the calendar successfully.");
            #endregion

            #region Attendee finds the meeting cancellation message from his Inbox folder
            MeetingCancellationMessageType cancelledMessage = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Canceled", meetingItem.UID) as MeetingCancellationMessageType;
            Site.Assert.IsNotNull(cancelledMessage, "Attendee should receive a meeting cancellation message after organizer calls DeleteItem with CalendarItemCreateOrDeleteOperationType set to SendOnlyToAll.");

            ItemIdType removeItemId = cancelledMessage.ItemId;
            RemoveItemType removeItem = new RemoveItemType();
            removeItem.ReferenceItemId = removeItemId;

            item = this.CreateSingleCalendarItem(Role.Attendee, removeItem, CalendarItemCreateOrDeleteOperationType.SendToNone);
            Site.Assert.IsNotNull(item, "The canceled message should be removed successfully.");
            #endregion

            #region Organizer checks whether the meeting cancellation message is saved to organizer's Sent Items folder
            MeetingCancellationMessageType cancelledMeeting = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.sentitems, "IPM.Schedule.Meeting.Canceled", meetingItem.UID) as MeetingCancellationMessageType;
            Site.Assert.IsNull(cancelledMeeting, "The meeting cancellation message should not be saved to organizer's Sent Items folder.");
            #endregion

            #region Clean up organizer's inbox, sentitems and deleteditems folders, and attendee's sentitems and deleteditems folders
            this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems });
            this.CleanupFoldersByRole(Role.Attendee, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems });
            #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
        }
        public void MSOXWSMTGS_S01_TC09_CreateAndCancelMeeting()
        {
            #region Organizer creates a meeting
            #region Set the properties of the meeting to create
            CalendarItemType meeting = new CalendarItemType();
            meeting.Subject = this.Subject;
            meeting.UID = Guid.NewGuid().ToString();
            meeting.Start = DateTime.UtcNow.AddDays(1);
            meeting.StartSpecified = true;
            meeting.End = meeting.Start.AddHours(2);
            meeting.EndSpecified = true;
            meeting.Location = this.Location;
            meeting.ConferenceType = 0;
            meeting.ConferenceTypeSpecified = true;
            meeting.AllowNewTimeProposal = false;
            meeting.AllowNewTimeProposalSpecified = true;
            if (Common.IsRequirementEnabled(2301, this.Site))
            {
                meeting.IsOnlineMeeting = false;
                meeting.IsOnlineMeetingSpecified = true;
            }
			
            meeting.LegacyFreeBusyStatus = LegacyFreeBusyType.Free;
            meeting.LegacyFreeBusyStatusSpecified = true;

            meeting.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };
            meeting.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.OrganizerEmailAddress) };
            meeting.Resources = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) };
            if (Common.IsRequirementEnabled(697, this.Site))
            {
                meeting.EnhancedLocation = new EnhancedLocationType();
                meeting.EnhancedLocation.DisplayName = Common.GenerateResourceName(this.Site, "Enhanced Location");
                meeting.EnhancedLocation.Annotation = Common.GenerateResourceName(this.Site, "Enhanced Location Annotation");
                meeting.EnhancedLocation.PostalAddress = new PersonaPostalAddressType();
                meeting.EnhancedLocation.PostalAddress.LocationSource = LocationSourceType.PhonebookServices;
                meeting.EnhancedLocation.PostalAddress.LocationSourceSpecified = true;
            }
            #endregion

            #region Create the meeting and sends it to all attendees
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meeting, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(item, "Create a meeting item should be successful.");
            #endregion
            #endregion

            #region Attendee gets and declines the meeting request in the Inbox folder
            CalendarItemType calendar = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meeting.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The calendar item should be found in attendee's Calendar folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendOnlyToAll.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R16501
            this.Site.CaptureRequirementIfAreEqual<LegacyFreeBusyType>(
                LegacyFreeBusyType.Free,
                calendar.LegacyFreeBusyStatus,
                16501,
                @"[In t:CalendarItemType Complex Type] The LegacyFreeBusyStatus which value is ""Free"" specifies the status as free.");

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

            #region Capture Code
            if (Common.IsRequirementEnabled(707, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R707");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R707
                this.Site.CaptureRequirementIfIsNotNull(
                    receivedRequest.EnhancedLocation,
                    707,
                    @"[In Appendix C: Product Behavior] Implementation does support the complex type ""EnhancedLocation"" with type ""EnhancedLocationType (section 2.2.4.10)"" which specifies enhanced location information. (Exchange 2013 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(3541, this.Site))
            {
                Site.Assert.IsTrue(receivedRequest.ConferenceTypeSpecified, "Element ConferenceType in MeetingRequestMessageType should be present.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R35500
                this.Site.CaptureRequirementIfAreEqual<int>(
                    meeting.ConferenceType,
                    receivedRequest.ConferenceType,
                    35500,
                    @"[In t:MeetingRequestMessageType Complex Type] The value of ""ConferenceType"" is ""0"" (zero) describes the type of conferencing is video conference");
            }

            if (Common.IsRequirementEnabled(2301, this.Site))
            {
                Site.Assert.IsTrue(receivedRequest.IsOnlineMeetingSpecified, "The element IsOnlineMeeting should be present.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R767
                this.Site.CaptureRequirementIfIsFalse(
                    receivedRequest.IsOnlineMeeting,
                    767,
                    @"[In t:MeetingRequestMessageType Complex Type] otherwise [if the meeting is not online], [IsOnlineMeeting is] false.");
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R28501
            this.Site.CaptureRequirementIfAreEqual<LegacyFreeBusyType>(
                LegacyFreeBusyType.Free,
                receivedRequest.IntendedFreeBusyStatus,
                28501,
                @"[In t:MeetingRequestMessageType Complex Type] The IntendedFreeBusyStatus which value is ""Free"" specifies the status as free.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R329
            // The format of the value of Duration elements followed xs:duration (as specified in [XMLSCHEMA2]), because of the duration set to 2 hours when create the meeting, therefore the expected value is "PT2H".
            this.Site.CaptureRequirementIfAreEqual<string>(
                "PT2H",
                receivedRequest.Duration,
                329,
                @"[In t:MeetingRequestMessageType Complex Type] Duration: Represents the duration of the meeting.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R3311
                this.Site.CaptureRequirementIfIsNotNull(
                    receivedRequest.TimeZone,
                    3311,
                    @"[In Appendix C: Product Behavior] Implementation does support TimeZone in MeetingRequestMessageType. (Exchange 2007, Exchange 2010 and Exchange 2013 follow this behavior.)");
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R335
            this.Site.CaptureRequirementIfAreEqual<int>(
                0,
                receivedRequest.AppointmentSequenceNumber,
                335,
                @"[In t:MeetingRequestMessageType Complex Type] AppointmentSequenceNumber: Specifies the sequence number of a version of an appointment.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R137
            Site.CaptureRequirementIfIsNotNull(
                receivedRequest,
                137,
                @"[In t:AttendeeType Complex Type]Mailbox:  Specifies a fully resolved e-mail address.");
            #endregion

            DeclineItemType declineItem = new DeclineItemType();
            declineItem.ReferenceItemId = new ItemIdType();
            declineItem.ReferenceItemId = receivedRequest.ItemId;

            item = this.CreateSingleCalendarItem(Role.Attendee, declineItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(item, "Decline meeting request should be successful.");
            #endregion
            #endregion

            #region Organizer gets the meeting response message and verify ResponseTypeType set to decline
            MeetingResponseMessageType response = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Resp", meeting.UID) as MeetingResponseMessageType;
            Site.Assert.IsNotNull(response, "Organizer should receive the meeting response message after attendee declines the meeting.");

            #region Capture Code
            if (Common.IsRequirementEnabled(80011, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R80011");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R80011
                this.Site.CaptureRequirementIfIsNotNull(
                    response.EnhancedLocation,
                    80011,
                    @"[In Appendix C: Product Behavior] Implementation does support the EnhancedLocation, which is an element of type EnhancedLocationType, as defined in section 2.2.4.10, that represents additional location information for the calendar item. (Exchange 2013 and above follow this behavior.)");
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R83
            this.Site.CaptureRequirementIfAreEqual<ResponseTypeType>(
                ResponseTypeType.Decline,
                response.ResponseType,
                83,
                @"[In t:ResponseTypeType Simple Type] Decline: Indicates that the recipient declined the meeting.");

            #endregion

            CancelCalendarItemType cancelMeetingItem = new CancelCalendarItemType();
            cancelMeetingItem.ReferenceItemId = response.AssociatedCalendarItemId;
            #endregion

            #region Organizer cancels the meeting
            item = this.CreateSingleCalendarItem(Role.Organizer, cancelMeetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R491
            Site.CaptureRequirementIfIsNotNull(
                item,
                491,
                @"[In CreateItem Operation] It [CreateItem operation] can also be used to cancel a meeting.");
            #endregion

            #region Attendee removes the canceled meeting
            MeetingCancellationMessageType meetingResponse = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Canceled", meeting.UID) as MeetingCancellationMessageType;
            Site.Assert.IsNotNull(meetingResponse, "Attendee should receive the meeting cancellation message after organizer calls CreateItem to create MeetingCancellationMessage with CalendarItemCreateOrDeleteOperationType set to SendOnlyToAll.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R490
            this.Site.CaptureRequirementIfAreEqual<string>(
                "IPM.Schedule.Meeting.Canceled",
                meetingResponse.ItemClass,
                490,
                @"[In CreateItem Operation] This operation [CreateItem] can be used to create meeting cancellation messages.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R80003
                this.Site.CaptureRequirementIfIsNotNull(
                    meetingResponse.EnhancedLocation,
                    80003,
                    @"[In t:MeetingCancellationMessageType Complex Type] EnhancedLocation: An element of type EnhancedLocationType, as defined in section 2.2.4.10, that specifies additional location information for a calendar item.");
            }

            #region Verify the child elements of MeetingResponseMessageType
            if (Common.IsRequirementEnabled(900, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R900");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R900
                this.Site.CaptureRequirementIfAreEqual<DateTime>(
                    meeting.Start.Date,
                    meetingResponse.Start.Date,
                    900,
                    @"[In Appendix C: Product Behavior] Implementation does support Start which is a dateTime element that represents the start time of the calendar item. (Exchange 2013 and above follow this behavior.)");
            }

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R901
                this.Site.CaptureRequirementIfAreEqual<DateTime>(
                    meeting.End.Date,
                    meetingResponse.End.Date,
                    901,
                    @"[In Appendix C: Product Behavior] Implementation does support End which is a dateTime element that represents the ending time of the calendar item. (Exchange 2013 and above follow this behavior.)");
            }

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R902
                this.Site.CaptureRequirementIfAreEqual<string>(
                    meeting.Location.ToLower(),
                    meetingResponse.Location.ToLower(),
                    902,
                    @"[In Appendix C: Product Behavior] Implementation does support Location which is a string element that represents the location of the calendar item. (Exchange 2013 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(904, this.Site))
            {
                CalendarItemTypeType actual;
                Site.Assert.IsTrue(Enum.TryParse<CalendarItemTypeType>(meetingResponse.CalendarItemType, out actual), "The current value of CalendarItemType should be able to convert into one of CalendarItemTypeType enum values.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R904
                this.Site.CaptureRequirementIfAreEqual<CalendarItemTypeType>(
                    CalendarItemTypeType.Single,
                    actual,
                    904,
                    @"[In Appendix C: Product Behavior] Implementation does support CalendarItemType which is a string element that represents the type of calendar item. (Exchange 2013 and above follow this behavior.)");
            }
            #endregion

            RemoveItemType removeItem = removeItem = new RemoveItemType();
            removeItem.ReferenceItemId = new ItemIdType();
            removeItem.ReferenceItemId = meetingResponse.ItemId;

            #region Remove the canceled meeting
            item = this.CreateSingleCalendarItem(Role.Attendee, removeItem, CalendarItemCreateOrDeleteOperationType.SendToNone);

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R492
            this.Site.CaptureRequirementIfIsNotNull(
                item,
                492,
                @"[In CreateItem Operation] and when a meeting is cancelled, it [CreateItem Operation] can be used to remove the meeting item and corresponding meeting cancellation message from the server.");
            #endregion
            #endregion

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