public void MSOXWSMTGS_S04_TC03_MoveRecurringCalendar() { #region Define a recurring calendar item to move DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = startTime; calendarItem.StartSpecified = true; calendarItem.End = startTime.AddHours(this.TimeInterval); calendarItem.EndSpecified = true; calendarItem.Recurrence = new RecurrenceType(); calendarItem.Recurrence.Item = pattern; calendarItem.Recurrence.Item1 = range; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone); OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey; occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id; occurrenceItemId.InstanceIndex = this.InstanceIndex; #endregion #region Get the Id of the occurrence item ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Organizer, occurrenceItemId); Site.Assert.IsNotNull(getItem, "Organizer should get the occurrence item successfully."); RecurringMasterItemIdType recurringMasterItemId = new RecurringMasterItemIdType(); recurringMasterItemId.ChangeKey = getItem.Items.Items[0].ItemId.ChangeKey; recurringMasterItemId.OccurrenceId = getItem.Items.Items[0].ItemId.Id; #endregion #region Move the recurring calendar item to Inbox folder DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.inbox; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; ItemInfoResponseMessageType movedItem = this.MoveSingleCalendarItem(Role.Organizer, recurringMasterItemId, targetFolderId); Site.Assert.IsNotNull(movedItem, @"Server should return success for moving the recurring calendar item."); #endregion #region Call FindItem to verify the recurring calendar item is moved to Inbox folder CalendarItemType calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.inbox, "IPM.Appointment", calendarItem.UID) as CalendarItemType; Site.Assert.IsNotNull(calendar, "The recurring calendar should be in organizer's inbox folder."); if (Common.IsRequirementEnabled(808, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R808"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R808 this.Site.CaptureRequirementIfAreEqual<CalendarItemTypeType>( CalendarItemTypeType.RecurringMaster, calendar.CalendarItemType1, 808, @"[In Appendix C: Product Behavior] MoveItemSoapIn: For each item being moved that is a recurring calendar item, implementation does contain a RecurringMasterItemId child element ([MS-OXWSCORE] section 2.2.4.11). (Exchange 2007 and above follow this behavior.)"); } #endregion #region Clean up organizer's inbox folder. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.inbox }); #endregion }
public void MSOXWSMTGS_S03_TC03_CopyRecurringCalendar() { #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = startTime; calendarItem.StartSpecified = true; calendarItem.End = startTime.AddHours(this.TimeInterval); calendarItem.EndSpecified = true; calendarItem.Recurrence = new RecurrenceType(); calendarItem.Recurrence.Item = pattern; calendarItem.Recurrence.Item1 = range; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone); OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey; occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id; occurrenceItemId.InstanceIndex = this.InstanceIndex; #endregion #region Get the targeted occurrence item ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Organizer, occurrenceItemId); Site.Assert.IsNotNull(getItem, @"Get the occurrence should be successful."); RecurringMasterItemIdType recurringMasterItemId = new RecurringMasterItemIdType(); recurringMasterItemId.ChangeKey = getItem.Items.Items[0].ItemId.ChangeKey; recurringMasterItemId.OccurrenceId = getItem.Items.Items[0].ItemId.Id; #endregion #region Copy the recurring calendar item to Drafts folder through Id of recurring master getItem DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.drafts; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; ItemInfoResponseMessageType copiedItem = this.CopySingleCalendarItem(Role.Organizer, recurringMasterItemId, targetFolderId); Site.Assert.IsNotNull(copiedItem, @"Copy recurring calendar item through RecurringMasterItemId should be successful."); ItemIdType calendarIdByCopied = copiedItem.Items.Items[0].ItemId; #endregion #region Call GetItem operation to verify whether the recurring calendar item is really copied getItem = this.GetSingleCalendarItem(Role.Organizer, calendarIdByCopied); if (Common.IsRequirementEnabled(806, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R806"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R806 this.Site.CaptureRequirementIfIsNotNull( getItem, 806, @"[In Appendix C: Product Behavior] CopyItemSoapIn: For each item being copied that is a recurring calendar item, implementation does contain a RecurringMasterItemId child element ([MS-OXWSCORE] section 2.2.4.11). (Exchange 2007 and above follow this behavior.)"); } #endregion #region Clean up organizer's drafts and calendar folders. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.drafts }); #endregion }
public void MSOXWSCORE_S05_TC17_GetMeetingItemWithFourItemIdTypesSuccessfully() { #region Step 1: Create a recurring calendar item. DateTime start = DateTime.Now; int numberOfOccurrences = 5; CalendarItemType item = this.CreateAndGetRecurringCalendarItem(start, numberOfOccurrences); #endregion #region Step 2: Get the first occurrence of the recurring calendar item by OccurrenceItemIdType. // The calendar item to get. OccurrenceItemIdType[] occurrenceItemId = new OccurrenceItemIdType[1]; occurrenceItemId[0] = new OccurrenceItemIdType(); occurrenceItemId[0].RecurringMasterId = item.ItemId.Id; occurrenceItemId[0].ChangeKey = item.FirstOccurrence.ItemId.ChangeKey; occurrenceItemId[0].InstanceIndex = 1; // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(occurrenceItemId); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); CalendarItemType[] getCalendarOccurences = Common.GetItemsFromInfoResponse<CalendarItemType>(getItemResponse); // One calendar item should be returned. Site.Assert.AreEqual<int>( 1, getCalendarOccurences.GetLength(0), "One calendar item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getCalendarOccurences.GetLength(0)); ItemIdType[] itemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); ItemIdId itemIdId = this.ITEMIDAdapter.ParseItemId(itemIds[0]); #endregion #region Step 3: Get the recurrence master calendar item by RecurringMasterItemIdType. // The calendar item to get. RecurringMasterItemIdType[] recurringMasterItemId = new RecurringMasterItemIdType[1]; recurringMasterItemId[0] = new RecurringMasterItemIdType(); // Use the first occurrence item id and change key to form the recurringMasterItemId recurringMasterItemId[0].OccurrenceId = item.FirstOccurrence.ItemId.Id; recurringMasterItemId[0].ChangeKey = item.FirstOccurrence.ItemId.ChangeKey; // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(recurringMasterItemId); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); CalendarItemType[] getCalendarRecurring = Common.GetItemsFromInfoResponse<CalendarItemType>(getItemResponse); // One calendar item should be returned. Site.Assert.AreEqual<int>( 1, getCalendarRecurring.GetLength(0), "One calendar item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getCalendarRecurring.GetLength(0)); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSITEMID_R67"); // Verify MS-OXWSITEMID requirement: MS-OXWSITEMID_R67 Site.CaptureRequirementIfAreEqual<IdProcessingInstructionType>( IdProcessingInstructionType.Recurrence, (IdProcessingInstructionType)itemIdId.IdProcessingInstruction, "MS-OXWSITEMID", 67, @"[In Id Storage Type (byte)] The Id processing uses the value of the following enumeration. /// <summary> /// Indicates any special processing to perform on an Id when deserializing it. /// </summary> internal enum IdProcessingInstruction : byte { [ /// <summary> /// No special processing. The Id represents a PR_ENTRY_ID /// </summary> Normal = 0, ] /// <summary> /// The Id represents an OccurenceStoreObjectId and therefore /// must be deserialized as a StoreObjectId. /// </summary> Recurrence = 1, [ /// <summary> /// The Id represents a series. /// </summary> Series = 2,] }"); #endregion // Clear ExistItemIds for DeleteItem. this.ExistItemIds.Clear(); this.ExistItemIds.Add(item.ItemId); }
public void MSOXWSCORE_S05_TC18_DeleteMeetingItemWithThreeItemIdTypesSuccessfully() { #region Step 1: Create and get a recurring calendar item. DateTime start = DateTime.Now; int numberOfOccurrences = 5; CalendarItemType calendar = this.CreateAndGetRecurringCalendarItem(start, numberOfOccurrences); #endregion #region Step 2: Delete the recurring calendar item by ItemIdType. DeleteItemResponseType deleteItemResponse = this.CallDeleteItemOperation(); // Check the operation response. Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); // Clear ExistItemIds for DeleteItem. this.InitializeCollection(); #endregion #region Step 3: Create and get a recurring calendar item. calendar = this.CreateAndGetRecurringCalendarItem(start, numberOfOccurrences); #endregion #region Step 4: Delete the recurrence master calendar item by RecurringMasterItemIdType. DeleteItemType deleteItemRequest = new DeleteItemType(); // The calendar item to delete. RecurringMasterItemIdType[] recurringMasterItemIds = new RecurringMasterItemIdType[1]; recurringMasterItemIds[0] = new RecurringMasterItemIdType(); recurringMasterItemIds[0].OccurrenceId = calendar.FirstOccurrence.ItemId.Id; recurringMasterItemIds[0].ChangeKey = calendar.FirstOccurrence.ItemId.ChangeKey; deleteItemRequest.ItemIds = recurringMasterItemIds; // Enumeration value to describe how an item is to be deleted. deleteItemRequest.DeleteType = DisposalType.HardDelete; // AffectedTaskOccurrences indicates whether a task instance or a task master is to be deleted. deleteItemRequest.AffectedTaskOccurrencesSpecified = true; deleteItemRequest.AffectedTaskOccurrences = AffectedTaskOccurrencesType.AllOccurrences; // SendMeetingCancellations describes how cancellations are to be handled for deleted meetings. deleteItemRequest.SendMeetingCancellationsSpecified = true; deleteItemRequest.SendMeetingCancellations = CalendarItemCreateOrDeleteOperationType.SendToNone; deleteItemResponse = this.COREAdapter.DeleteItem(deleteItemRequest); // Check the operation response. Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); // Clear ExistItemIds for DeleteItem. this.InitializeCollection(); #endregion #region Step 5: Create and get a recurring calendar item. calendar = this.CreateAndGetRecurringCalendarItem(start, numberOfOccurrences); #endregion #region Step 6: Delete the first occurrence of the recurring calendar item by OccurrenceItemIdType. deleteItemRequest = new DeleteItemType(); // The calendar item to delete. OccurrenceItemIdType[] occurrenceItemIds = new OccurrenceItemIdType[1]; occurrenceItemIds[0] = new OccurrenceItemIdType(); occurrenceItemIds[0].RecurringMasterId = calendar.ItemId.Id; occurrenceItemIds[0].ChangeKey = calendar.FirstOccurrence.ItemId.ChangeKey; occurrenceItemIds[0].InstanceIndex = 1; deleteItemRequest.ItemIds = occurrenceItemIds; // Enumeration value to describe how an item is to be deleted. deleteItemRequest.DeleteType = DisposalType.HardDelete; // AffectedTaskOccurrences indicates whether a task instance or a task master is to be deleted. deleteItemRequest.AffectedTaskOccurrencesSpecified = true; deleteItemRequest.AffectedTaskOccurrences = AffectedTaskOccurrencesType.AllOccurrences; // SendMeetingCancellations describes how cancellations are to be handled for deleted meetings. deleteItemRequest.SendMeetingCancellationsSpecified = true; deleteItemRequest.SendMeetingCancellations = CalendarItemCreateOrDeleteOperationType.SendToNone; deleteItemResponse = this.COREAdapter.DeleteItem(deleteItemRequest); // Check the operation response. Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); #endregion }
public void MSOXWSMTGS_S01_TC21_DeleteItemErrorSendMeetingCancellationsRequired() { #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = startTime; calendarItem.StartSpecified = true; calendarItem.End = startTime.AddHours(this.TimeInterval); calendarItem.EndSpecified = true; calendarItem.Recurrence = new RecurrenceType(); calendarItem.Recurrence.Item = pattern; calendarItem.Recurrence.Item1 = range; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone); OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey; occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id; occurrenceItemId.InstanceIndex = this.InstanceIndex; #endregion #region Get the targeted occurrence item ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Organizer, occurrenceItemId); Site.Assert.IsNotNull(getItem, @"Get the occurrence should be successful."); RecurringMasterItemIdType invalidRecurringMasterItemId = new RecurringMasterItemIdType(); invalidRecurringMasterItemId.ChangeKey = getItem.Items.Items[0].ItemId.ChangeKey; invalidRecurringMasterItemId.OccurrenceId = getItem.Items.Items[0].ItemId.Id; #endregion #region Delete the occurrence DeleteItemType deleteItemRequest = new DeleteItemType(); deleteItemRequest.ItemIds = new BaseItemIdType[] { occurrenceItemId }; deleteItemRequest.DeleteType = DisposalType.HardDelete; DeleteItemResponseType deleteItemResponse = this.MTGSAdapter.DeleteItem(deleteItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1209"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1209 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, deleteItemResponse.ResponseMessages.Items[0].ResponseClass, 1209, @"[In Messages] If the request is unsuccessful, the DeleteItem operation returns a DeleteItemResponse element with the ResponseClass attribute of the DeleteItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1213"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1213 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorSendMeetingCancellationsRequired, deleteItemResponse.ResponseMessages.Items[0].ResponseCode, 1213, @"[In Messages] ErrorSendMeetingCancellationsRequired: Occurs during a DeleteItem call, when the SendMeetingCancellations property is missing from the request and the item to delete is a calendar item. "); #endregion #region Clean up organizer's calendar folders. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar }); #endregion }