Inheritance: MeetingMessageType
        /// <summary>
        /// Loop to find the item with the specified subject.
        /// </summary>
        /// <param name="folderName">Name of the specified folder.</param>
        /// <param name="itemSubject">Subject of the specified item.</param>
        /// <param name="itemType">Type of the specified item.</param>
        /// <returns>Item with the specified subject.</returns>
        private ItemType LoopToFindItem(DistinguishedFolderIdNameType folderName, string itemSubject, Item itemType)
        {
            ItemType[] items = null;
            ItemType firstFoundItem = null;
            int sleepTimes = 0;

            // Get the query sleep delay and times from ptfconfig file.
            int queryDelay = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int queryTimes = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));

            // Loop to find the item, in case that the sent item has still not been received.
            do
            {
                Thread.Sleep(queryDelay);
                items = this.FindAllItems(folderName);
                sleepTimes++;
            }
            while (items == null && sleepTimes < queryTimes);

            ItemType type = null;

            switch (itemType)
            {
                case Item.MeetingRequest:
                    type = new MeetingRequestMessageType();
                    break;
                case Item.MeetingResponse:
                    type = new MeetingResponseMessageType();
                    break;
                case Item.MeetingCancellation:
                    type = new MeetingCancellationMessageType();
                    break;
                case Item.CalendarItem:
                    type = new CalendarItemType();
                    break;
            }

            if (items != null)
            {
                // Find the item with the specified subject and store its ID.
                for (int i = 0; i < items.Length; i++)
                {
                    if (items[i].Subject.Contains(itemSubject) && items[i].GetType().ToString() == type.ToString())
                    {
                        firstFoundItem = items[i];
                        break;
                    }
                }
            }

            return firstFoundItem;
        }
        /// <summary>
        /// Verify the MeetingRequestMessageType structure
        /// </summary>
        /// <param name="meetingRequestMessage">Represents a meeting request in the messaging server store</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyMeetingRequestMessageType(MeetingRequestMessageType meetingRequestMessage, bool isSchemaValidated)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R281");

            this.Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                281,
                @"[In t:MeetingRequestMessageType Complex Type] [Its schema is]
<xs:complexContent>
  <xs:extension base=""t:MeetingMessageType"">
    <xs:sequence>
      <!--- MeetingRequest properties -->
      <xs:element name=""MeetingRequestType"" type=""t:MeetingRequestTypeType"" minOccurs=""0""/>
      <xs:element name=""IntendedFreeBusyStatus"" type=""t:LegacyFreeBusyType"" minOccurs=""0""/>
      <!-- Calendar Properties of the associated meeting request -->
      <!-- Single and Occurrence only -->
      <xs:element name=""Start"" type=""xs:dateTime"" minOccurs=""0""/>
      <xs:element name=""End"" type=""xs:dateTime"" minOccurs=""0""/>
      <!-- Occurrence only -->
      <xs:element name=""OriginalStart"" type=""xs:dateTime"" minOccurs=""0""/>
      <xs:element name=""IsAllDayEvent"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""LegacyFreeBusyStatus"" type=""t:LegacyFreeBusyType"" minOccurs=""0""/>
      <xs:element name=""Location"" type=""xs:string"" minOccurs=""0""/>
      <xs:element name=""When"" type=""xs:string"" minOccurs=""0""/>
      <xs:element name=""IsMeeting"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""IsCancelled"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""IsRecurring"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""MeetingRequestWasSent"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""CalendarItemType"" type=""t:CalendarItemTypeType"" minOccurs=""0""/>
      <xs:element name=""MyResponseType"" type=""t:ResponseTypeType"" minOccurs=""0""/>
      <xs:element name=""Organizer"" type=""t:SingleRecipientType"" minOccurs=""0""/>
      <xs:element name=""RequiredAttendees"" type=""t:NonEmptyArrayOfAttendeesType"" minOccurs=""0""/>
      <xs:element name=""OptionalAttendees"" type=""t:NonEmptyArrayOfAttendeesType"" minOccurs=""0""/>
      <xs:element name=""Resources"" type=""t:NonEmptyArrayOfAttendeesType"" minOccurs=""0""/>
      <!-- Conflicting and adjacent meetings -->
      <xs:element name=""ConflictingMeetingCount"" type=""xs:int"" minOccurs=""0""/>
      <xs:element name=""AdjacentMeetingCount"" type=""xs:int"" minOccurs=""0""/>
      <xs:element name=""ConflictingMeetings"" type=""t:NonEmptyArrayOfAllItemsType"" minOccurs=""0""/>
      <xs:element name=""AdjacentMeetings"" type=""t:NonEmptyArrayOfAllItemsType"" minOccurs=""0""/>
      <xs:element name=""Duration"" type=""xs:string"" minOccurs=""0""/>
      <xs:element name=""TimeZone"" type=""xs:string"" minOccurs=""0""/>
      <xs:element name=""AppointmentReplyTime"" type=""xs:dateTime"" minOccurs=""0""/>
      <xs:element name=""AppointmentSequenceNumber"" type=""xs:int"" minOccurs=""0""/>
      <xs:element name=""AppointmentState"" type=""xs:int"" minOccurs=""0""/>
      <!-- Recurrence specific data, only valid if CalendarItemType is RecurringMaster -->
      <xs:element name=""Recurrence"" type=""t:RecurrenceType"" minOccurs=""0""/>
      <xs:element name=""FirstOccurrence"" type=""t:OccurrenceInfoType"" minOccurs=""0""/>
      <xs:element name=""LastOccurrence"" type=""t:OccurrenceInfoType"" minOccurs=""0""/>
      <xs:element name=""ModifiedOccurrences"" type=""t:NonEmptyArrayOfOccurrenceInfoType"" minOccurs=""0""/>
      <xs:element name=""DeletedOccurrences"" type=""t:NonEmptyArrayOfDeletedOccurrencesType"" minOccurs=""0""/>
      <xs:element name=""MeetingTimeZone"" type=""t:TimeZoneType"" minOccurs=""0""/>
      <xs:element name=""StartTimeZone"" type=""t:TimeZoneDefinitionType"" minOccurs=""0""/>
      <xs:element name=""EndTimeZone"" type=""t:TimeZoneDefinitionType"" minOccurs=""0""/>
      <xs:element name=""ConferenceType"" type=""xs:int"" minOccurs=""0""/>
      <xs:element name=""AllowNewTimeProposal"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""IsOnlineMeeting"" type=""xs:boolean"" minOccurs=""0""/>
      <xs:element name=""MeetingWorkspaceUrl"" type=""xs:string"" minOccurs=""0""/>
      <xs:element name=""NetShowUrl"" type=""xs:string"" minOccurs=""0""/>
      <xs:element name=""EnhancedLocation"" type=""t:EnhancedLocationType"" minOccurs=""0""/>
      <xs:element name=""ChangeHighlights"" type=""t:ChangeHighlightsType"" minOccurs=""0""/>
      <xs:element name=""StartWallClock"" type=""xs:dateTime"" minOccurs=""0"" maxOccurs=""1""/>
      <xs:element name=""EndWallClock"" type=""xs:dateTime"" minOccurs=""0"" maxOccurs=""1""/>
      <xs:element name=""StartTimeZoneId"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1""/>
      <xs:element name=""EndTimeZoneId"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1""/>
    </xs:sequence>
  </xs:extension>
</xs:complexContent>
</xs:complexType>");

            #region Verify MeetingRequestMessageType structure

            if (meetingRequestMessage.Resources != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R318");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R318
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    318,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of Resources is t:NonEmptyArrayOfAttendeesType.");
            }

            if (meetingRequestMessage.MeetingRequestTypeSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R282");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R282
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    282,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of MeetingRequestType is t:MeetingRequestTypeType (section 2.2.5.7).");

                this.VerifyMeetingRequestTypeType(isSchemaValidated);
            }

            if (meetingRequestMessage.IntendedFreeBusyStatusSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R284");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R284
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    284,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of IntendedFreeBusyStatus is t:LegacyFreeBusyType ([MS-OXWSCDATA] section 2.2.3.17).");
            }

            if (meetingRequestMessage.Start != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R499");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R499
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    499,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of Start is  xs:dateTime ([XMLSCHEMA2])");
            }

            if (meetingRequestMessage.Start != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R286");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R286
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    286,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of End is xs:dateTime.");
            }

            if (!string.IsNullOrEmpty(meetingRequestMessage.Location))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R296");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R296
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    296,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of Location is xs:string ([XMLSCHEMA2]).");
            }

            if (meetingRequestMessage.IsMeetingSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R300");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R300
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    300,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of IsMeeting is xs:boolean.");
            }

            if (meetingRequestMessage.IsCancelledSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R302");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R302
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    302,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of IsCancelled is xs:boolean.");
            }

            if (meetingRequestMessage.IsRecurringSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R304");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R304
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    304,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of IsRecurring is xs:boolean.");
            }

            if (meetingRequestMessage.MeetingRequestWasSentSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R306");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R306
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    306,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of MeetingRequestWasSent is xs:boolean.");
            }

            if (meetingRequestMessage.CalendarItemTypeSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R308");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R308
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    308,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of CalendarItemType is t:CalendarItemTypeType.");

                this.VerifyCalendarItemTypeType(isSchemaValidated);
            }

            if (meetingRequestMessage.Organizer != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R312");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R312
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    312,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of Organizer is t:SingleRecipientType ([MS-OXWSCDATA] section 2.2.4.60).");

                this.VerifySingleRecipientType(meetingRequestMessage.Organizer, isSchemaValidated);
            }

            if (meetingRequestMessage.RequiredAttendees != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R314");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R314
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    314,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of RequiredAttendees is t:NonEmptyArrayOfAttendeesType (section 2.2.4.15).");

                this.VeirfyNonEmptyArrayOfAttendeesType(meetingRequestMessage.RequiredAttendees, isSchemaValidated);
            }

            if (meetingRequestMessage.OptionalAttendees != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R316");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R316
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    316,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of OptionalAttendees is t:NonEmptyArrayOfAttendeesType.");

                this.VeirfyNonEmptyArrayOfAttendeesType(meetingRequestMessage.OptionalAttendees, isSchemaValidated);
            }

            if (meetingRequestMessage.ConflictingMeetingCountSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R320");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R320
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    320,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of ConflictingMeetingCount is xs:int ([XMLSCHEMA2]).");
            }

            if (meetingRequestMessage.AdjacentMeetingCountSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R322");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R322
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    322,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of AdjacentMeetingCount is xs:int.");
            }

            if (meetingRequestMessage.ConflictingMeetings != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R324");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R324
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    324,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of ConflictingMeetings is t:NonEmptyArrayOfAllItemsType ([MS-OXWSCDATA] section 2.2.4.42)");

                this.VerifyNonEmptyArrayOfAllItemsType(isSchemaValidated);
            }

            if (meetingRequestMessage.AdjacentMeetings != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R326");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R326
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    326,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of AdjacentMeetings is t:NonEmptyArrayOfAllItemsType.");

                this.VerifyNonEmptyArrayOfAllItemsType(isSchemaValidated);
            }

            if (!string.IsNullOrEmpty(meetingRequestMessage.Duration))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R328");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R328
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    328,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of Duration is xs:string.");
            }

            if (!string.IsNullOrEmpty(meetingRequestMessage.TimeZone))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R330");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R330
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    330,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of TimeZone is xs:string.");
            }

            if (meetingRequestMessage.AppointmentSequenceNumberSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R334");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R334
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    334,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of AppointmentSequenceNumber is xs:int.");
            }

            if (meetingRequestMessage.AppointmentStateSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R336");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R336
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    336,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of AppointmentState is xs:int.");
            }

            if (meetingRequestMessage.Recurrence != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R338");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R338
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    338,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of Recurrence is t:RecurrenceType (section 2.2.4.20).");

                this.VerifyRecurrenceType(meetingRequestMessage.Recurrence, isSchemaValidated);
            }

            if (meetingRequestMessage.FirstOccurrence != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R340");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R340
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    340,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of FirstOccurrence is t:OccurrenceInfoType (section 2.2.4.18).");

                this.VerifyOccurrenceInfoType(isSchemaValidated);
            }

            if (meetingRequestMessage.LastOccurrence != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R342");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R342
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    342,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of LastOccurrence is t:OccurrenceInfoType.");

                this.VerifyOccurrenceInfoType(isSchemaValidated);
            }

            if (meetingRequestMessage.ModifiedOccurrences != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R344");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R344
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    344,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of ModifiedOccurrences is t:NonEmptyArrayOfOccurrenceInfoType (section 2.2.4.17).");
            }

            if (meetingRequestMessage.DeletedOccurrences != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R346");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R346
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    346,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of DeletedOccurrences is t:NonEmptyArrayOfDeletedOccurrencesType (section 2.2.4.16).");
            }

            if (meetingRequestMessage.IsOnlineMeetingSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R358");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R358
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    358,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of IsOnlineMeeting is xs:boolean.");
            }

            if (!string.IsNullOrEmpty(meetingRequestMessage.MeetingWorkspaceUrl))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R360");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R360
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    360,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of MeetingWorkspaceUrl is xs:string.");
            }

            if (!string.IsNullOrEmpty(meetingRequestMessage.NetShowUrl))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R362");

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R362
                Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    362,
                    @"[In t:MeetingRequestMessageType Complex Type] The type of NetShowUrl is xs:string.");
            }
            #endregion

            if (meetingRequestMessage != null)
            {
                this.VerifyMeetingMessageType(meetingRequestMessage, isSchemaValidated);
            }
        }