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
}