public void MSOXWSCORE_S08_TC05_UpdateTypesOfItemsFailed() { Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST"); #region Step 1: Create Items. ItemIdType[] createdItemIds = CreateAllTypesItems(); #endregion #region Step 2: Update items. // Initialize the change item to update. UpdateItemType updateRequest = new UpdateItemType(); ItemChangeType[] itemChanges = new ItemChangeType[createdItemIds.Length]; // Set two properties (Subject and ReminderMinutesBeforeStart) to update, in order to return an error "ErrorIncorrectUpdatePropertyCount". for (int i = 0; i < createdItemIds.Length; i++) { itemChanges[i] = new ItemChangeType(); itemChanges[i].Item = createdItemIds[i]; itemChanges[i].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem1 = new SetItemFieldType(); setItem1.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject }; setItem1.Item1 = new ContactItemType() { Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForUpdateItem), ReminderMinutesBeforeStart = TestSuiteHelper.ReminderMinutesBeforeStart }; itemChanges[i].Updates[0] = setItem1; } updateRequest.ItemChanges = itemChanges; updateRequest.MessageDispositionSpecified = true; updateRequest.MessageDisposition = MessageDispositionType.SaveOnly; updateRequest.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToAllAndSaveCopy; updateRequest.SendMeetingInvitationsOrCancellationsSpecified = true; // Call UpdateItem to update the Subject and the ReminderMinutesBeforeStart of the created item simultaneously. UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateRequest); foreach (ResponseMessageType responseMessage in updateItemResponse.ResponseMessages.Items) { // Verify ResponseCode is ErrorIncorrectUpdatePropertyCount. this.VerifyErrorIncorrectUpdatePropertyCount(responseMessage.ResponseCode); } #endregion }
/// <summary> /// Update subject of specific items. /// </summary> /// <param name="itemIds">An array of folder identifiers.</param> /// <returns>If item updated successfully.</returns> protected bool UpdateItemSubject(params ItemIdType[] itemIds) { UpdateItemType updateRequest = new UpdateItemType(); ItemChangeType[] itemChanges = new ItemChangeType[itemIds.Length]; for (int index = 0; index < itemIds.Length; index++) { itemChanges[index] = new ItemChangeType(); itemChanges[index].Item = itemIds[index]; itemChanges[index].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject }; setItem.Item1 = new ContactItemType() { Subject = Common.GenerateResourceName(this.Site, "ItemSubjectUpdated", (uint)index), }; itemChanges[index].Updates[0] = setItem; } updateRequest.ItemChanges = itemChanges; updateRequest.MessageDispositionSpecified = true; updateRequest.MessageDisposition = MessageDispositionType.SaveOnly; updateRequest.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToAllAndSaveCopy; updateRequest.SendMeetingInvitationsOrCancellationsSpecified = true; UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateRequest); // A Boolean indicates whether the response is a success. bool isSuccess = new bool(); for (int index = 0; index < itemIds.Length; index++) { isSuccess = ResponseClassType.Success == updateItemResponse.ResponseMessages.Items[index].ResponseClass; if (isSuccess) { continue; } else { break; } } return isSuccess; }
public void MSOXWSCORE_S04_TC25_UpdateItemWithSuppressReadReceipts() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2315, this.Site), "Exchange 2007, Exchange 2010, and the initial release of Exchange 2013 do not support the SuppressReadReceipts attribute."); #region Send an email with setting IsReadReceiptRequested to true. MessageType message = new MessageType(); message.IsReadReceiptRequestedSpecified = true; message.IsReadReceiptRequested = true; message.ToRecipients = new EmailAddressType[1]; EmailAddressType recipient = new EmailAddressType(); recipient.EmailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); message.ToRecipients[0] = recipient; message.From = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) } }; CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { message }; createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 1); createItemRequest.MessageDisposition = MessageDispositionType.SendOnly; createItemRequest.MessageDispositionSpecified = true; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Find the email in receiver's inbox. ItemIdType[] findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.IsNotNull(findItemIds, "The receiver should receive the email."); #endregion #region Update the found email with setting SuppressReadReceipts to true. ItemChangeType[] itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); itemChanges[0].Item = findItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItemFiled = new SetItemFieldType(); setItemFiled.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.messageIsRead }; setItemFiled.Item1 = new MessageType() { IsRead = true, IsReadSpecified = true }; itemChanges[0].Updates[0] = setItemFiled; UpdateItemType updateItemType = new UpdateItemType(); updateItemType.ItemChanges = itemChanges; updateItemType.ConflictResolution = ConflictResolutionType.AutoResolve; updateItemType.MessageDisposition = MessageDispositionType.SaveOnly; updateItemType.MessageDispositionSpecified = true; updateItemType.SuppressReadReceipts = true; updateItemType.SuppressReadReceiptsSpecified = true; UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateItemType); Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User1"); Site.Assert.IsNull(findItemIds, "The read receipt email should not be received if receiver update the email with setting SuppressReadReceipts to true."); List<string> subjects = new List<string>(); subjects.Add(createItemRequest.Items.Items[0].Subject); this.ExistItemIds.Clear(); #endregion #region Send an email with setting IsReadReceiptRequested to true. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 2); createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Find the email in receiver's inbox. findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.IsNotNull(findItemIds, "The receiver should receive the email."); #endregion #region Update the found email with setting SuppressReadReceipts to false. updateItemType.ItemChanges[0].Item = findItemIds[0]; updateItemType.SuppressReadReceipts = false; updateItemResponse = this.COREAdapter.UpdateItem(updateItemType); Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User1"); Site.Assert.AreEqual<int>(1, findItemIds.Length, "The read receipt email should not be received if receiver update the email with setting SuppressReadReceipts to true."); subjects.Add(createItemRequest.Items.Items[0].Subject); this.ExistItemIds.Clear(); this.ExistItemIds.Add(findItemIds[0]); this.CleanItemsSentOut(subjects.ToArray()); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2315"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2315 // This requirement can be captured directly after above steps. this.Site.CaptureRequirement( 2315, @"[In Appendix C: Product Behavior] Implementation does support the SuppressReadReceipts attribute specifies whether read receipts are suppressed. (<102> Section 3.1.4.9.3.2: This attribute [SuppressReadReceipts] was introduced in Exchange 2013 SP1.)"); #endregion }
public void MSOXWSCORE_S08_TC04_UpdateTypesOfItemsSuccessfully() { Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST"); #region Step 1: Create Items. ItemIdType[] createdItemIds = CreateAllTypesItems(); #endregion #region Step 2: Update items. ItemChangeType[] itemChanges = new ItemChangeType[createdItemIds.Length]; // Set the public properties (Subject) which all the seven kinds of operation have. for (int i = 0; i < createdItemIds.Length; i++) { itemChanges[i] = new ItemChangeType(); itemChanges[i].Item = createdItemIds[i]; itemChanges[i].Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject }, Item1 = new ItemType() { Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForUpdateItem) } } }; } UpdateItemResponseType updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, createdItemIds.Length, this.Site); #endregion }
public void MSOXWSCORE_S05_TC22_VerifyCompareOriginalStartTime() { #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: 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 = calendar.ItemId.Id; occurrenceItemId[0].ChangeKey = calendar.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: Update the start date of the calendar item. ItemChangeType itemChange = new ItemChangeType(); itemChange.Item = itemIds[0]; CalendarItemType calendarChange = new CalendarItemType(); calendarChange.Start = calendar.Start.AddMinutes(20); calendarChange.StartSpecified = true; itemChange.Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItemField = new SetItemFieldType(); setItemField.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.calendarStart }; setItemField.Item1 = calendarChange; itemChange.Updates[0] = setItemField; UpdateItemResponseType updatedItem = this.CallUpdateItemOperation(DistinguishedFolderIdNameType.calendar, true, new ItemChangeType[] { itemChange }); #endregion SutVersion currentSutVersion = (SutVersion)Enum.Parse(typeof(SutVersion), Common.GetConfigurationPropertyValue("SutVersion", this.Site)); if (currentSutVersion.Equals(SutVersion.ExchangeServer2016)) { #region Step 4: Get the recurring calendar item by RecurringMasterItemIdRangesType with set CompareOriginalStartTime to true. // The calendar item to get. RecurringMasterItemIdRangesType[] recurringMasterItemIdRanges = new RecurringMasterItemIdRangesType[1]; recurringMasterItemIdRanges[0] = new RecurringMasterItemIdRangesType(); // Use the first occurrence item id and change key to form the recurringMasterItemId recurringMasterItemIdRanges[0].Id = calendar.ItemId.Id; recurringMasterItemIdRanges[0].ChangeKey = calendar.ItemId.ChangeKey; recurringMasterItemIdRanges[0].Ranges = new OccurrencesRangeType[1]; recurringMasterItemIdRanges[0].Ranges[0] = new OccurrencesRangeType(); recurringMasterItemIdRanges[0].Ranges[0].Start = calendar.Start.AddMinutes(10); recurringMasterItemIdRanges[0].Ranges[0].StartSpecified = true; recurringMasterItemIdRanges[0].Ranges[0].End = start.AddDays(5); recurringMasterItemIdRanges[0].Ranges[0].EndSpecified = true; recurringMasterItemIdRanges[0].Ranges[0].Count = 5; recurringMasterItemIdRanges[0].Ranges[0].CountSpecified = true; recurringMasterItemIdRanges[0].Ranges[0].CompareOriginalStartTime = true; recurringMasterItemIdRanges[0].Ranges[0].CompareOriginalStartTimeSpecified = true; // Call the GetItem operation. GetItemResponseType getItemResponse1 = this.CallGetItemOperation(recurringMasterItemIdRanges); // Check the operation response. Common.CheckOperationSuccess(getItemResponse1, 1, this.Site); CalendarItemType[] getCalendarRecurring = Common.GetItemsFromInfoResponse<CalendarItemType>(getItemResponse1); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1697"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1697 this.Site.CaptureRequirementIfAreEqual( 5, getCalendarRecurring.Length, 1697, @"[In t:OccurrencesRangeType Complex Type] [CompareOriginalStartTime is] True, indicates comparing the specified ranges to an original start time."); #endregion #region Step 5: Get the recurrence master calendar item by RecurringMasterItemIdRangesType with set CompareOriginalStartTime to false. // The calendar item to get. recurringMasterItemIdRanges[0].Ranges[0].CompareOriginalStartTime = false; recurringMasterItemIdRanges[0].Ranges[0].CompareOriginalStartTimeSpecified = true; // Call the GetItem operation. getItemResponse1 = this.CallGetItemOperation(recurringMasterItemIdRanges); // Check the operation response. Common.CheckOperationSuccess(getItemResponse1, 1, this.Site); getCalendarRecurring = Common.GetItemsFromInfoResponse<CalendarItemType>(getItemResponse1); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1698"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1698 this.Site.CaptureRequirementIfAreEqual( 6, getCalendarRecurring.Length, 1698, @"[In t:OccurrencesRangeType Complex Type] otherwise [CompareOriginalStartTime is] false, indicates comparing the specified ranges to a pair of start and end values."); #endregion } // Clear ExistItemIds for DeleteItem. this.ExistItemIds.Clear(); this.ExistItemIds.Add(calendar.ItemId); }
public void MSOXWSCORE_S04_TC20_VerifyOperationsWithSOAPHeaderSuccessful() { #region Step 1: Create one item with recipient. // Clear the soap header. this.ClearSoapHeaders(); // Configure the SOAP headers for CreateItem and UpdateItem operations. Dictionary<string, object> headerValues = new Dictionary<string, object>(); headerValues = this.ConfigureSOAPHeader(); // Configure the TimeZoneContext SOAP Header. TimeZoneContextType timeZoneContext = new TimeZoneContextType(); timeZoneContext.TimeZoneDefinition = new TimeZoneDefinitionType(); timeZoneContext.TimeZoneDefinition.Id = TestSuiteHelper.TimeZoneID; headerValues.Add("TimeZoneContext", timeZoneContext); this.COREAdapter.ConfigureSOAPHeader(headerValues); // Call the CreateItem operation and save the item to Drafts folder. MessageType[] items = new MessageType[] { this.CreateItemWithOneRecipient() }; CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, items); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); MessageType[] createdItems = Common.GetItemsFromInfoResponse<MessageType>(createItemResponse); // One created items should be returned. Site.Assert.AreEqual<int>( 1, createdItems.GetLength(0), "One created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdItems.GetLength(0)); #endregion #region Step 2: Update the item which is created in Step 1. ItemChangeType[] itemChanges = new ItemChangeType[] { TestSuiteHelper.CreateItemChangeItem(createdItems[0], 1) }; // Clear ExistItemIds list for MoveItem. this.InitializeCollection(); // Call UpdateItem operation to update the subject of the created item, by using the ItemId in CreateItem response. UpdateItemResponseType updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); // Clear the soap header. this.ClearSoapHeaders(); #endregion #region Step 3: Move the item updated in Step 2 from Drafts folder to Inbox folder. // Configure the SOAP headers for MoveItem and MarkAllItemsAsRead operations. headerValues.Remove("TimeZoneContext"); this.COREAdapter.ConfigureSOAPHeader(headerValues); // Call the MoveItem operation, by using the ItemId in UpdateItem response. ItemIdType[] draftsItem = new ItemIdType[this.ExistItemIds.Count]; this.ExistItemIds.CopyTo(draftsItem, 0); this.InitializeCollection(); MoveItemResponseType moveItemResponse = this.CallMoveItemOperation(DistinguishedFolderIdNameType.inbox, draftsItem); // Check the operation response. Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); #endregion #region Step 4: Mark all items in Inbox folder as read. // Exchange 2007 and Exchange 2010 do not support the MarkAllItemsAsRead operation. if (Common.IsRequirementEnabled(1290, this.Site)) { // Configure Inbox folder as the target folder. BaseFolderIdType[] folderIds = new BaseFolderIdType[1]; DistinguishedFolderIdType distinguishedFolder = new DistinguishedFolderIdType(); distinguishedFolder.Id = DistinguishedFolderIdNameType.inbox; folderIds[0] = distinguishedFolder; // Mark all items in Inbox folder as unread, and suppress the receive receipts. MarkAllItemsAsReadResponseType markAllItemsAsReadResponse = this.CallMarkAllItemsAsReadOperation(true, true, folderIds); // Check the operation response. Common.CheckOperationSuccess(markAllItemsAsReadResponse, 1, this.Site); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1290"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1290 // The MarkAllItemsAsRead operation was executed successfully, so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( this.IsSchemaValidated, 1290, @"[In Appendix C: Product Behavior] Implementation does support the MarkAllItemsAsRead operation which marks all items in a folder as read. (Exchange 2013 and above follow this behavior.)"); } // Clear the soap header. this.ClearSoapHeaders(); #endregion #region Step 5: Get the item in Inbox folder. // Configure the SOAP headers for GetItem. headerValues.Add("TimeZoneContext", timeZoneContext); this.COREAdapter.ConfigureSOAPHeader(headerValues); // Call the GetItem operation, by using the ItemId in MoveItem response. ItemIdType[] itemArray = new ItemIdType[this.ExistItemIds.Count]; this.ExistItemIds.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); // Clear the soap header. this.ClearSoapHeaders(); #endregion #region Step 6: Copy the message type item from Inbox folder to Drafts folder. // Configure the SOAP headers for CopyItem, SendItem and DeleteItem. headerValues.Remove("TimeZoneContext"); this.COREAdapter.ConfigureSOAPHeader(headerValues); // Save the ID of the item in Inbox folder and call the CopyItem operation. itemArray = new ItemIdType[this.ExistItemIds.Count]; this.ExistItemIds.CopyTo(itemArray, 0); CopyItemResponseType copyItemResponse = this.CallCopyItemOperation(DistinguishedFolderIdNameType.drafts, itemArray); // Check the operation response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); // One copied item should be returned. Site.Assert.AreEqual<int>( 1, copiedItemIds.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIds.GetLength(0)); #endregion #region Step 7: Send the item in Drafts folder. // Call SendItem to send the copied item in Drafts folder, by using copiedItemIds in CopyItem response. SendItemResponseType sendResponse = this.CallSendItemOperation( copiedItemIds, DistinguishedFolderIdNameType.sentitems, false); // Check the operation response. Common.CheckOperationSuccess(sendResponse, 1, this.Site); // Remove the sent itemId from ExistItemIds list, since the item has been sent out and no copy remains. this.ExistItemIds.Remove(copiedItemIds[0] as ItemIdType); #endregion #region Step 8: Delete the item in Inbox folder and clean all items sent out. // Delete the item in Inbox folder and clear the ExistItemIds list. DeleteItemResponseType deleteItemResponse = this.CallDeleteItemOperation(); // Check the operation response. Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); this.InitializeCollection(); // Clear the soap header. this.ClearSoapHeaders(); // Clean the items sent out. this.CleanItemsSentOut(new string[] { items[0].Subject }); #endregion }
public void MSOXWSCORE_S01_TC04_UpdateItemSuccessfully() { #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Update the item, using AppendToItemField element. UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; AppendToItemFieldType append = new AppendToItemFieldType(); append.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemBody }; append.Item1 = new ItemType() { Body = new BodyType() { BodyType1 = BodyTypeType.Text, Value = TestSuiteHelper.BodyForBaseItem } }; itemChanges[0].Updates[0] = append; // Call UpdateItem to update the body of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); ItemIdType[] updatedItemIds = createdItemIds; // One updated item should be returned. Site.Assert.AreEqual<int>( 1, updatedItemIds.GetLength(0), "One updated item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, updatedItemIds.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R508"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R508 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponse, 508, @"[In m:UpdateItemResponseType Complex Type] The UpdateItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); UpdateItemResponseMessageType updateItemResponseMessage = updateItemResponse.ResponseMessages.Items[0] as UpdateItemResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R158"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R158 this.Site.CaptureRequirementIfIsTrue( updateItemResponseMessage.Items.Items[0].ItemId.Id == createdItemIds[0].Id && updateItemResponseMessage.Items.Items[0].ItemId.ChangeKey != createdItemIds[0].ChangeKey, 158, @"[In t:ItemIdType Complex Type] [The attribute ""ChangeKey""] Specifies a change key."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R58"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R58 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage, 58, @"[In m:UpdateItemResponseMessageType Complex Type] The UpdateItemResponseMessageType complex type extends the ItemInfoResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.37)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1586"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1586 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage, "MS-OXWSCDATA", 1586, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""UpdateItemResponseMessage"" is ""m:UpdateItemResponseMessageType"" type ([MS-OXWSCORE] section 2.2.4.6)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1040"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1040 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage, "MS-OXWSCDATA", 1040, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""UpdateItemResponseMessage"" with type ""m:UpdateItemResponseMessageType"" specifies the response message for the UpdateItem operation ([MS-OXWSCORE] section 3.1.4.9)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1305"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1305 // The schema is validated and the conflict result is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage.ConflictResults, 1305, @"[In m:UpdateItemResponseMessageType Complex Type] The type of ConflictResults is t:ConflictResultsType (section 2.2.4.7)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1306"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1306 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1306, @"[In t:ConflictResultsType Complex Type] The type of Count is xs:int [XMLSCHEMA2]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R65"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R65 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 65, @"[In t:ConflictResultsType Complex Type] [The element ""Count""] Specifies an integer value that indicates the number of conflicts in an UpdateItem operation response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R61"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R61 // The schema is validated and the conflict result is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage.ConflictResults, 61, @"[In m:UpdateItemResponseMessageType Complex Type] [The element ""ConflictResults""] Specifies the number of conflicts in the result of a single call."); #endregion #region Step 3: Get the item to check the updates. // Call GetItem to get the updated item, by using updatedItemIds in UpdateItem response. GetItemResponseType getItemResponse = this.CallGetItemOperation(updatedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); ItemInfoResponseMessageType getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; Site.Assert.AreEqual<BodyTypeType>( append.Item1.Body.BodyType1, getItemResponseMessage.Items.Items[0].Body.BodyType1, string.Format( "The value of BodyType1 should be {0}, actual {1}.", append.Item1.Body.BodyType1, getItemResponseMessage.Items.Items[0].Body.BodyType1)); Site.Assert.AreEqual<string>( append.Item1.Body.Value, getItemResponseMessage.Items.Items[0].Body.Value, string.Format( "The value of Body should be {0}, actual {1}.", append.Item1.Body.Value, getItemResponseMessage.Items.Items[0].Body.Value)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R555"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R555 // The value of BodyType1 from response is equal to the value of BodyType1 from the request, // and the value of Body from response is equal to the value of Body from request, // so this requirement can be captured. this.Site.CaptureRequirement( 555, @"[In t:NonEmptyArrayOfItemChangeDescriptionsType Complex Type] [The element ""AppendToItemField""] Specifies data to append to a single property of an item during an UpdateItem operation."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R561"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R561 // The value of BodyType1 from response is equal to the value of BodyType1 from the request, // and the value of Body from response is equal to the value of Body from request, // so this requirement can be captured. this.Site.CaptureRequirement( 561, @"[In t:NonEmptyArrayOfItemChangesType Complex Type] [The element ""ItemChange""] Specifies an item identifier and the updates to apply to the item."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R514"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R514 // Because the value of SavedItemFolderId cannot be compared with the parent folder id from response. // So if the updated item can be gotten successfully, this requirement can be captured. this.Site.CaptureRequirement( 514, @"[In m:UpdateItemType Complex Type] [The element ""SavedItemFolderId""] Specifies the target folder for saved items."); #endregion #region Step 4: Update the item, using SetItemField element. itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); itemChanges[0].Item = getItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject }; setItem.Item1 = new ItemType() { Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForUpdateItem) }; itemChanges[0].Updates[0] = setItem; // Call UpdateItem to update the subject of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); updatedItemIds = Common.GetItemIdsFromInfoResponse(updateItemResponse); // One updated item should be returned. Site.Assert.AreEqual<int>( 1, updatedItemIds.GetLength(0), "One updated item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, updatedItemIds.GetLength(0)); #endregion #region Step 5: Get the item to check the updates. // Call GetItem to get the updated item in the Inbox folder, by using updatedItemIds in UpdateItem response. getItemResponse = this.CallGetItemOperation(updatedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R556"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R556 this.Site.CaptureRequirementIfAreEqual<string>( setItem.Item1.Subject, getItemResponseMessage.Items.Items[0].Subject, 556, @"[In t:NonEmptyArrayOfItemChangeDescriptionsType Complex Type] [The element ""SetItemField""] Specifies an update to a single property of an item in an UpdateItem operation."); #endregion #region Step 6: Update the item, using DeleteItemField element. itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); itemChanges[0].Item = getItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; DeleteItemFieldType delField = new DeleteItemFieldType(); delField.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemBody }; itemChanges[0].Updates[0] = delField; // Call UpdateItem to delete the body value of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); updatedItemIds = Common.GetItemIdsFromInfoResponse(updateItemResponse); // One updated item should be returned. Site.Assert.AreEqual<int>( 1, updatedItemIds.GetLength(0), "One updated item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, updatedItemIds.GetLength(0)); #endregion #region Step 7: Get the item to check the updates // Call GetItem to get the updated item in the Inbox folder, by using updatedItemIds in UpdateItem response. getItemResponse = this.CallGetItemOperation(updatedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R557"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R557 // The value of Body is null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNull( getItemResponseMessage.Items.Items[0].Body.Value, 557, @"[In t:NonEmptyArrayOfItemChangeDescriptionsType Complex Type] [The element ""DeleteItemField"" with type ""t:DeleteItemFieldType""] Specifies an operation to delete a given property from an item during an UpdateItem operation."); #endregion }
/// <summary> /// Generate UpdateItemRequest. /// </summary> /// <param name="createItemIds">The created item id.</param> /// <returns>Generated GetItemRequest.</returns> public static UpdateItemType GenerateUpdateItemRequest(params ItemIdType[] createItemIds) { // Specify needed to update value for the task item. TaskType taskUpdate = new TaskType { Companies = new string[] { "Company3", "Company4" } }; // Define the ItemChangeType element for updating the task item's companies. PathToUnindexedFieldType pathTo = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.taskCompanies }; SetItemFieldType setItemField = new SetItemFieldType() { Item = pathTo, Item1 = taskUpdate }; ItemChangeType[] itemChanges = new ItemChangeType[createItemIds.Length]; for (int i = 0; i < createItemIds.Length; i++) { ItemChangeType itemChange = new ItemChangeType() { Item = createItemIds[i], Updates = new ItemChangeDescriptionType[] { setItemField } }; itemChanges[i] = itemChange; } // Return the UpdateItemType request to update the task item. return new UpdateItemType() { ItemChanges = itemChanges, ConflictResolution = ConflictResolutionType.AlwaysOverwrite }; }
public void MSOXWSCORE_S01_TC42_IconIndexIsReadOnly() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1917, this.Site), "Exchange 2007 and Exchange 2010 do not support the IconIndex element."); #region Create an item with setting IconIndex ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].IconIndexSpecified = true; createdItems[0].IconIndex = IconIndexType.TaskRecur; CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2062"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2062 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2062, @"[In t:ItemType Complex Type] This element [IconIndex] is read-only."); #endregion #region Update an item with setting IconIndex ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemIconIndex }; setItem.Item1 = new ItemType() { IconIndex = IconIndexType.TaskRecur, IconIndexSpecified = true }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2358"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2358 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2358, @"[In t:ItemType Complex Type] but if [IconIndex] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
public void MSOXWSCORE_S01_TC43_RightsManagementLicenseDataIsReadOnly() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1355, this.Site), "Exchange 2007 and Exchange 2010 do not support the RightsManagementLicenseData element."); #region Create an item with setting RightsManagementLicenseData ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].RightsManagementLicenseData = new RightsManagementLicenseDataType(); createdItems[0].RightsManagementLicenseData.EditAllowedSpecified = true; createdItems[0].RightsManagementLicenseData.EditAllowed = true; CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2052"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2052 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2052, @"[In t:ItemType Complex Type] This element [RightsManagementLicenseData] is read-only."); #endregion #region Update an item with setting RightsManagementLicenseData ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemRightsManagementLicenseData }; setItem.Item1 = new ItemType() { RightsManagementLicenseData = new RightsManagementLicenseDataType { EditAllowed = true, EditAllowedSpecified = true } }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2353"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2353 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2353, @"[In t:ItemType Complex Type] but if [RightsManagementLicenseData] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1355"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1355 // Server handles the element RightsManagementLicenseData and returns ErrorInvalidPropertySet, this requirement can be captured directly. this.Site.CaptureRequirement( 1355, @"[In Appendix C: Product Behavior] Implementation does support element ""RightsManagementLicenseData"" with type ""t:RightsManagementLicenseDataType (section 2.2.4.37)"" which specifies rights management license data. (Exchange 2013 and above follow this behavior.)"); #endregion }
public void MSOXWSCORE_S01_TC37_LastModifiedNameIsReadOnly() { #region Create an item with setting LastModifiedName ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].LastModifiedName = Common.GenerateResourceName(this.Site, "LastModifiedName"); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2039"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2039 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2039, @"[In t:ItemType Complex Type] This element [LastModifiedName] is read-only."); #endregion #region Update an item with setting LastModifiedName ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemLastModifiedName }; setItem.Item1 = new ItemType() { LastModifiedName = Common.GenerateResourceName(this.Site, "LastModifiedName") }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2277"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2277 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2277, @"[In t:ItemType Complex Type] but if [LastModifiedName] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
public void MSOXWSCORE_S01_TC29_ItemIdIsReadOnly() { #region Create an item with setting ItemId ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].ItemId = new ItemIdType(); createdItems[0].ItemId.Id = Common.GenerateResourceName(this.Site, "Id"); createdItems[0].ItemId.ChangeKey = Common.GenerateResourceName(this.Site, "ChangeKey"); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2014"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2014 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2014, @"[In t:ItemType Complex Type] This element [ItemId] is read-only."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2171"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2171 this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, createItemResponse.ResponseMessages.Items[0].ResponseClass, 2171, @"[In tns:CreateItemSoapOut Message] If the request is unsuccessful, the CreateItem operation returns a CreateItemResponse element with the ResponseClass attribute of the CreateItemResponseMessage element set to ""Error""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2172"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2172 // MS-OXWSCORE_R2014 is captured, this requirement can be captured directly. this.Site.CaptureRequirement( 2172, @"[In tns:CreateItemSoapOut Message] The ResponseCode element of the CreateItemResponseMessage element is set to a value of the ResponseCodeType simple type, as specified in [MS-OXWSCDATA] section 2.2.5.24."); #endregion #region Update an item with setting ItemId ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemItemId }; setItem.Item1 = new ItemType() { ItemId = new ItemIdType() { Id = Common.GenerateResourceName(this.Site, "Id"), ChangeKey = Common.GenerateResourceName(this.Site, "ChangeKey") } }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2347"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2347 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2347, @"[In t:ItemType Complex Type] but if [ItemId] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
public void MSOXWSCORE_S01_TC23_WebClientReadFormQueryStringIsReadOnly() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2338, this.Site), "Exchange 2007 does not support the WebClientReadFormQueryString element."); #region Step 1: Create the item with setting WebClientReadFormQueryString. ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].WebClientReadFormQueryString = Common.GenerateResourceName(this.Site, "WebClientReadFormQueryString"); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2043"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2043 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2043, @"[In t:ItemType Complex Type] This element [WebClientReadFormQueryString] is read-only and may be returned by the server but if specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion #region Step 2: Update created item with setting WebClientReadFormQueryString. ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemWebClientReadFormQueryString }; setItem.Item1 = new ItemType() { WebClientReadFormQueryString = Common.GenerateResourceName(this.Site, "WebClientReadFormQueryString") }; itemChanges[0].Updates[0] = setItem; // Call UpdateItem to update the body of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2043"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2043 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2043, @"[In t:ItemType Complex Type] This element [WebClientReadFormQueryString] is read-only and may be returned by the server but if specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
public void MSOXWSMTGS_S02_TC12_UpdateItemErrorCalendarDurationIsTooLong() { #region Define a calendar item int timeInterval = this.TimeInterval; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = DateTime.Now.AddHours(timeInterval); calendarItem.StartSpecified = true; calendarItem.End = calendarItem.Start.AddDays(6); calendarItem.EndSpecified = true; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { calendarItem }; createItemRequest.MessageDispositionSpecified = true; createItemRequest.MessageDisposition = MessageDispositionType.SaveOnly; createItemRequest.SendMeetingInvitationsSpecified = true; createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone; CreateItemResponseType response = this.MTGSAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(response, 1, this.Site); #endregion #region Update the calendar to make the duration exceeds 5 years. CalendarItemType calendarUpdate = new CalendarItemType(); calendarUpdate.End = calendarItem.Start.AddYears(6); calendarUpdate.EndSpecified = true; UpdateItemType updateItemRequest = new UpdateItemType(); updateItemRequest.ItemChanges = new ItemChangeType[1]; PathToUnindexedFieldType pathToUnindexedField = new PathToUnindexedFieldType(); pathToUnindexedField.FieldURI = UnindexedFieldURIType.calendarEnd; SetItemFieldType setItemField = new SetItemFieldType(); setItemField.Item = pathToUnindexedField; setItemField.Item1 = calendarUpdate; ItemChangeType itemChange = new ItemChangeType(); itemChange.Item = (response.ResponseMessages.Items[0] as ItemInfoResponseMessageType).Items.Items[0].ItemId; itemChange.Updates = new ItemChangeDescriptionType[] { setItemField }; updateItemRequest.ItemChanges[0] = itemChange; updateItemRequest.SendMeetingInvitationsOrCancellationsSpecified = true; updateItemRequest.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToNone; UpdateItemResponseType updateItemResponse = this.MTGSAdapter.UpdateItem(updateItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1244"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1244 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorCalendarDurationIsTooLong, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 1244, @"[In Messages] ErrorCalendarDurationIsTooLong: Specifies that the item duration of a calendar item exceeds five years."); #endregion #region Clean up organizer's calendar folders. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar }); #endregion }
public void MSOXWSMTGS_S02_TC11_UpdateItemErrorMessageDispositionRequired() { #region Create a message without setting MessageDisposition element. CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { new MessageType() }; createItemRequest.Items.Items[0].Subject = this.Subject; DistinguishedFolderIdType folderIdForCreateItems = new DistinguishedFolderIdType(); folderIdForCreateItems.Id = DistinguishedFolderIdNameType.drafts; createItemRequest.SavedItemFolderId = new TargetFolderIdType(); createItemRequest.SavedItemFolderId.Item = folderIdForCreateItems; CreateItemResponseType createItemResponse = this.MTGSAdapter.CreateItem(createItemRequest); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1241"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1241 this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, createItemResponse.ResponseMessages.Items[0].ResponseClass, 1241, @"[In Messages] ErrorMessageDispositionRequired:This error code MUST be returned under the following conditions: When the item that is being created or updated is a MessageType object. [For the CancelCalendarItemType, AcceptItemType, DeclineItemType, or TentativelyAcceptItemType response objects.]"); #endregion #region Create a message with setting MessageDisposition element. createItemRequest.MessageDisposition = MessageDispositionType.SaveOnly; createItemRequest.MessageDispositionSpecified = true; createItemResponse = this.MTGSAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Update the message without setting MessageDisposition element. MessageType messageUpdate = new MessageType(); messageUpdate.Subject = this.SubjectUpdate; UpdateItemType updateItemRequest = new UpdateItemType(); updateItemRequest.ItemChanges = new ItemChangeType[1]; PathToUnindexedFieldType pathToUnindexedField = new PathToUnindexedFieldType(); pathToUnindexedField.FieldURI = UnindexedFieldURIType.itemSubject; SetItemFieldType setItemField = new SetItemFieldType(); setItemField.Item = pathToUnindexedField; setItemField.Item1 = messageUpdate; ItemChangeType itemChange = new ItemChangeType(); itemChange.Item = (createItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType).Items.Items[0].ItemId; itemChange.Updates = new ItemChangeDescriptionType[] { setItemField }; updateItemRequest.ItemChanges[0] = itemChange; UpdateItemResponseType updateItemResponse = this.MTGSAdapter.UpdateItem(updateItemRequest); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1237"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1237 this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, updateItemResponse.ResponseMessages.Items[0].ResponseClass, 1237, @"[In Messages] If the request is unsuccessful, the UpdateItem operation returns an UpdateItemResponse element with the ResponseClass attribute of the UpdateItemResponseMessage element set to ""Error"". "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1240"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1240 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorMessageDispositionRequired, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 1240, @"[In Messages] ErrorMessageDispositionRequired: Occurs if the MessageDisposition property is not set. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1241"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1241 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorMessageDispositionRequired, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 1241, @"[In Messages] ErrorMessageDispositionRequired:This error code MUST be returned under the following conditions: When the item that is being created or updated is a MessageType object. [For the CancelCalendarItemType, AcceptItemType, DeclineItemType, or TentativelyAcceptItemType response objects.]"); #endregion #region Clean up organizer's drafts folders. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.drafts }); #endregion }