public void MSASCMD_S17_TC05_SmartForwardWithInstanceIdSuccess() { Site.Assume.AreNotEqual <string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Recurrences cannot be added in protocol version 16.0"); #region User1 calls SendMail command to send one recurring meeting request to user2. string meetingRequestSubject = Common.GenerateResourceName(Site, "subject"); string attendeeEmailAddress = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); this.SendWeeklyRecurrenceMeetingRequest(meetingRequestSubject, attendeeEmailAddress); #endregion #region User2 calls Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); SyncResponse syncMeetingMailResponse = this.GetMailItem(this.User2Information.InboxCollectionId, meetingRequestSubject); // Record relative items for clean up. TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject); #endregion #region User2 calls MeetingResponse command to accept the meeting string serverIDForMeetingRequest = TestSuiteBase.FindServerId(syncMeetingMailResponse, "Subject", meetingRequestSubject); MeetingResponseRequest meetingResponseRequest = TestSuiteBase.CreateMeetingResponseRequest(1, this.User2Information.InboxCollectionId, serverIDForMeetingRequest, string.Empty); // If the user accepts the meeting request, the meeting request mail will be deleted and calendar item will be created. MeetingResponseResponse meetingResponseResponse = this.CMDAdapter.MeetingResponse(meetingResponseRequest); Site.Assert.IsNotNull(meetingResponseResponse.ResponseData.Result[0].CalendarId, "If the meeting was accepted, server should return calendarId in response"); TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject); this.GetMailItem(this.User2Information.DeletedItemsCollectionId, meetingRequestSubject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.DeletedItemsCollectionId, meetingRequestSubject); #endregion #region User2 calls Sync command to sync user calendar changes SyncResponse syncCalendarResponse = this.GetMailItem(this.User2Information.CalendarCollectionId, meetingRequestSubject); string calendarItemID = TestSuiteBase.FindServerId(syncCalendarResponse, "Subject", meetingRequestSubject); string startTime = (string)TestSuiteBase.GetElementValueFromSyncResponse(syncCalendarResponse, calendarItemID, Response.ItemsChoiceType8.StartTime); Response.Recurrence recurrence = (Response.Recurrence)TestSuiteBase.GetElementValueFromSyncResponse(syncCalendarResponse, calendarItemID, Response.ItemsChoiceType8.Recurrence); Site.Assert.IsNotNull(recurrence, "If user2 received recurring meeting request, the calendar item should contain recurrence element"); // Record relative items for clean up. TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.CalendarCollectionId, meetingRequestSubject); #endregion #region User2 calls SmartForward command to forward the calendar item to user3 with correct InstanceId value in SmartForward request string forwardFromUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string forwardToUser = Common.GetMailAddress(this.User3Information.UserName, this.User3Information.UserDomain); string forwardSubject = string.Format("FW:{0}", meetingRequestSubject); string forwardContent = Common.GenerateResourceName(Site, "forward:Meeting Instance body"); SmartForwardRequest smartForwardRequest = this.CreateSmartForwardRequest(this.User2Information.CalendarCollectionId, calendarItemID, forwardFromUser, forwardToUser, string.Empty, string.Empty, forwardSubject, forwardContent); // Set instanceID with format the same as required format "2010-03-20T22:40:00.000Z". string instanceID = ConvertInstanceIdFormat(startTime); smartForwardRequest.RequestData.Source.InstanceId = instanceID; SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); Site.Assert.AreEqual(string.Empty, smartForwardResponse.ResponseDataXML, "If SmartForward command executes successfully, server should return empty xml data"); #endregion #region After user2 forwards email to user3, sync user3 mailbox changes this.SwitchUser(this.User3Information); SyncResponse syncForwardResult = this.GetMailItem(this.User3Information.InboxCollectionId, forwardSubject); string forwardItemServerID = TestSuiteBase.FindServerId(syncForwardResult, "Subject", forwardSubject); // Sync user3 Calendar folder SyncResponse syncUser3CalendarFolder = this.GetMailItem(this.User3Information.CalendarCollectionId, forwardSubject); string user3CalendarItemID = TestSuiteBase.FindServerId(syncUser3CalendarFolder, "Subject", forwardSubject); // Record email items for clean up TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User3Information.InboxCollectionId, forwardSubject); TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User3Information.CalendarCollectionId, forwardSubject); #endregion #region Record the meeting forward notification mail which sent from server to User1. this.SwitchUser(this.User1Information); string notificationSubject = "Meeting Forward Notification: " + forwardSubject; TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, notificationSubject); this.GetMailItem(this.User1Information.DeletedItemsCollectionId, notificationSubject); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R538"); // Verify MS-ASCMD requirement: MS-ASCMD_R538 // If the calendar item with specified subject exists in user3 Calendar folder and email item exists in user3 Inbox folder which means user3 gets the forwarded mail. Site.CaptureRequirementIfIsTrue( user3CalendarItemID != null && forwardItemServerID != null, 538, @"[In SmartForward] When SmartForward is applied to a recurring meeting, the InstanceId element (section 2.2.3.83.2) specifies the ID of a particular occurrence in the recurring meeting."); }