/// <summary> /// Log on to a mailbox with a specified user account and create a search folder. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="userPassword">Password of the user.</param> /// <param name="userDomain">Domain of the user.</param> /// <param name="searchFolderName">Name of the search folder.</param> /// <param name="searchText">Search text of the search folder.</param> /// <returns>If the search folder is created successfully, return true; otherwise, return false.</returns> public bool CreateSearchFolder(string userName, string userPassword, string userDomain, string searchFolderName, string searchText) { // Log on mailbox with specified user account(userName, userPassword, userDomain). bool isLoged = AdapterHelper.SwitchUser(userName, userPassword, userDomain, this.exchangeServiceBinding, this.Site); Site.Assert.IsTrue( isLoged, string.Format("Log on mailbox with the UserName: {0}, Password: {1}, Domain: {2} should be successful.", userName, userPassword, userDomain)); // Create the request. CreateFolderType createFolder = new CreateFolderType(); SearchFolderType[] folderArray = new SearchFolderType[1]; SearchFolderType searchFolder = new SearchFolderType(); // Use the following search filter to get all mail in the Inbox with the word searchText in the subject line. searchFolder.SearchParameters = new SearchParametersType(); searchFolder.SearchParameters.Traversal = SearchFolderTraversalType.Deep; searchFolder.SearchParameters.TraversalSpecified = true; searchFolder.SearchParameters.BaseFolderIds = new DistinguishedFolderIdType[4]; // Create a distinguished folder Identified of the inbox folder. DistinguishedFolderIdType inboxFolder = new DistinguishedFolderIdType(); inboxFolder.Id = new DistinguishedFolderIdNameType(); inboxFolder.Id = DistinguishedFolderIdNameType.inbox; searchFolder.SearchParameters.BaseFolderIds[0] = inboxFolder; DistinguishedFolderIdType contactType = new DistinguishedFolderIdType(); contactType.Id = new DistinguishedFolderIdNameType(); contactType.Id = DistinguishedFolderIdNameType.contacts; searchFolder.SearchParameters.BaseFolderIds[1] = contactType; DistinguishedFolderIdType calendarType = new DistinguishedFolderIdType(); calendarType.Id = new DistinguishedFolderIdNameType(); calendarType.Id = DistinguishedFolderIdNameType.calendar; searchFolder.SearchParameters.BaseFolderIds[2] = calendarType; DistinguishedFolderIdType taskType = new DistinguishedFolderIdType(); taskType.Id = new DistinguishedFolderIdNameType(); taskType.Id = DistinguishedFolderIdNameType.calendar; searchFolder.SearchParameters.BaseFolderIds[3] = taskType; // Use the following search filter. searchFolder.SearchParameters.Restriction = new RestrictionType(); PathToUnindexedFieldType path = new PathToUnindexedFieldType(); path.FieldURI = UnindexedFieldURIType.itemSubject; RestrictionType restriction = new RestrictionType(); FieldURIOrConstantType fieldURIORConstant = new FieldURIOrConstantType(); fieldURIORConstant.Item = new ConstantValueType(); (fieldURIORConstant.Item as ConstantValueType).Value = searchText; ExistsType isEqual = new ExistsType(); isEqual.Item = path; restriction.Item = isEqual; searchFolder.SearchParameters.Restriction = restriction; // Give the search folder a unique name. searchFolder.DisplayName = searchFolderName; folderArray[0] = searchFolder; // Create the search folder under the default Search Folder. TargetFolderIdType targetFolder = new TargetFolderIdType(); DistinguishedFolderIdType searchFolders = new DistinguishedFolderIdType(); searchFolders.Id = DistinguishedFolderIdNameType.searchfolders; targetFolder.Item = searchFolders; createFolder.ParentFolderId = targetFolder; createFolder.Folders = folderArray; bool isSearchFolderCreated = false; // Invoke CreateFolder operation and get the response. CreateFolderResponseType response = this.exchangeServiceBinding.CreateFolder(createFolder); if (response != null && ResponseClassType.Success == response.ResponseMessages.Items[0].ResponseClass) { // If the search folder is created successfully, return true; otherwise, return false. isSearchFolderCreated = true; searchFolder.FolderId = ((FolderInfoResponseMessageType)response.ResponseMessages.Items[0]).Folders[0].FolderId; AdapterHelper.CreatedFolders.Add(searchFolder); } return isSearchFolderCreated; }
/// <summary> /// Generate the request message for operation "UpdateFolder". /// </summary> /// <param name="folderType">An array of folder types.</param> /// <param name="updateType">An array of update folder types.</param> /// <param name="folderIds">An array of folder Ids.</param> /// <returns>Update folder request instance that will send to server.</returns> protected UpdateFolderType GetUpdateFolderRequest(string[] folderType, string[] updateType, FolderIdType[] folderIds) { Site.Assert.AreEqual<int>(folderType.Length, folderIds.Length, "Folder type count should equal to folder id count!"); Site.Assert.AreEqual<int>(folderType.Length, updateType.Length, "Folder type count should equal to update type count!"); // UpdateFolder request. UpdateFolderType updateFolderRequest = new UpdateFolderType(); int folderCount = folderIds.Length; // Set the request's folder id field to Custom Folder's folder id. updateFolderRequest.FolderChanges = new FolderChangeType[folderCount]; for (int folderIndex = 0; folderIndex < folderCount; folderIndex++) { updateFolderRequest.FolderChanges[folderIndex] = new FolderChangeType(); updateFolderRequest.FolderChanges[folderIndex].Item = folderIds[folderIndex]; // Add the array of changes; in this case, a single element array. updateFolderRequest.FolderChanges[folderIndex].Updates = new FolderChangeDescriptionType[1]; switch (updateType[folderIndex]) { case "SetFolderField": { // Set the new folder name of the specific folder. SetFolderFieldType setFolderField = new SetFolderFieldType(); PathToUnindexedFieldType displayNameProp = new PathToUnindexedFieldType(); displayNameProp.FieldURI = UnindexedFieldURIType.folderDisplayName; switch (folderType[folderIndex]) { case "Folder": FolderType updatedFolder = new FolderType(); updatedFolder.DisplayName = Common.GenerateResourceName(this.Site, "UpdatedFolder" + folderIndex); setFolderField.Item1 = updatedFolder; break; case "CalendarFolder": CalendarFolderType updatedCalendarFolder = new CalendarFolderType(); updatedCalendarFolder.DisplayName = Common.GenerateResourceName(this.Site, "UpdatedFolder" + folderIndex); setFolderField.Item1 = updatedCalendarFolder; break; case "ContactsFolder": CalendarFolderType updatedContactFolder = new CalendarFolderType(); updatedContactFolder.DisplayName = Common.GenerateResourceName(this.Site, "UpdatedFolder" + folderIndex); setFolderField.Item1 = updatedContactFolder; break; case "SearchFolder": CalendarFolderType updatedSearchFolder = new CalendarFolderType(); updatedSearchFolder.DisplayName = Common.GenerateResourceName(this.Site, "UpdatedFolder" + folderIndex); setFolderField.Item1 = updatedSearchFolder; break; case "TasksFolder": CalendarFolderType updatedTaskFolder = new CalendarFolderType(); updatedTaskFolder.DisplayName = Common.GenerateResourceName(this.Site, "UpdatedFolder" + folderIndex); setFolderField.Item1 = updatedTaskFolder; break; default: FolderType generalFolder = new FolderType(); generalFolder.DisplayName = Common.GenerateResourceName(this.Site, "UpdatedFolder" + folderIndex); setFolderField.Item1 = generalFolder; break; } setFolderField.Item = displayNameProp; updateFolderRequest.FolderChanges[folderIndex].Updates[0] = setFolderField; } break; case "DeleteFolderField": { // Use DeleteFolderFieldType. DeleteFolderFieldType delFolder = new DeleteFolderFieldType(); PathToUnindexedFieldType delProp = new PathToUnindexedFieldType(); delProp.FieldURI = UnindexedFieldURIType.folderPermissionSet; delFolder.Item = delProp; updateFolderRequest.FolderChanges[folderIndex].Updates[0] = delFolder; } break; case "AppendToFolderField": { // Use AppendToFolderFieldType. AppendToFolderFieldType appendToFolderField = new AppendToFolderFieldType(); PathToUnindexedFieldType displayNameAppendTo = new PathToUnindexedFieldType(); displayNameAppendTo.FieldURI = UnindexedFieldURIType.calendarAdjacentMeetings; appendToFolderField.Item = displayNameAppendTo; FolderType folderAppendTo = new FolderType(); folderAppendTo.FolderId = folderIds[folderIndex]; appendToFolderField.Item1 = folderAppendTo; updateFolderRequest.FolderChanges[folderIndex].Updates[0] = appendToFolderField; } break; } } return updateFolderRequest; }
/// <summary> /// The method searches the mailbox and returns the items that meet a specified search restriction. /// </summary> /// <param name="folder">A string that specifies the folder to search.</param> /// <param name="value">A string that specifies the value for a search restriction.</param> /// <returns>If the method succeeds, return an array of item; otherwise, return null.</returns> private ItemIdType[] GetItemIds(string folder, string value) { #region Construct FindItem request FindItemType findRequest = new FindItemType(); if (string.IsNullOrEmpty(folder) || string.IsNullOrEmpty(value)) { Site.Assert.Fail("Invalid argument: one or more invalid arguments passed to GetItemIds method."); } findRequest.ItemShape = new ItemResponseShapeType(); findRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); DistinguishedFolderIdNameType folderIdName; if (Enum.TryParse<DistinguishedFolderIdNameType>(folder, out folderIdName)) { folderId.Id = folderIdName; } else { Site.Assert.Fail("The value of the first argument (foldIdNameType) of FindItem operation is invalid."); } findRequest.ParentFolderIds = new BaseFolderIdType[1]; findRequest.ParentFolderIds[0] = folderId; PathToUnindexedFieldType itemClass = new PathToUnindexedFieldType(); itemClass.FieldURI = UnindexedFieldURIType.itemSubject; ContainsExpressionType expressionType = new ContainsExpressionType(); expressionType.Item = itemClass; expressionType.ContainmentMode = ContainmentModeType.Substring; expressionType.ContainmentModeSpecified = true; expressionType.ContainmentComparison = ContainmentComparisonType.IgnoreCaseAndNonSpacingCharacters; expressionType.ContainmentComparisonSpecified = true; expressionType.Constant = new ConstantValueType(); expressionType.Constant.Value = value; RestrictionType restriction = new RestrictionType(); restriction.Item = expressionType; findRequest.Restriction = restriction; #endregion #region Get the ids of all ItemId instances int counter = 0; int upperBound = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); FindItemResponseType findResponse = new FindItemResponseType(); while (counter < upperBound) { Thread.Sleep(waitTime); findResponse = this.exchangeServiceBinding.FindItem(findRequest); if (findResponse != null && findResponse.ResponseMessages != null && findResponse.ResponseMessages.Items != null && findResponse.ResponseMessages.Items.Length > 0) { ArrayOfRealItemsType items = ((FindItemResponseMessageType)findResponse.ResponseMessages.Items[0]).RootFolder.Item as ArrayOfRealItemsType; if (items.Items != null && items.Items.Length > 0) { List<ItemIdType> itemIds = new List<ItemIdType>(); foreach (ItemType item in items.Items) { if (item.ItemId != null) { itemIds.Add(item.ItemId); } } if (itemIds.Count > 0) { return itemIds.ToArray(); } } } counter++; } Site.Log.Add(LogEntryKind.Debug, "When there is not any message found by FindItem operation, the retry count is {0}", counter); return null; #endregion }
/// <summary> /// The operation construct a request for FindItem operation. /// </summary> /// <param name="folderName">A string that specifies the folder to search.</param> /// <param name="value">A string that specifies the value for a search restriction.</param> /// <param name="field">A string that specifies the type of referenced field URI.</param> /// <returns>The request of FindItem operation which constructed with special folder name, search restriction and referenced field URI</returns> protected FindItemType ConstructFindItemRequest(string folderName, string value, string field) { FindItemType findRequest = new FindItemType(); findRequest.ItemShape = new ItemResponseShapeType(); findRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); DistinguishedFolderIdNameType folderIdName; if (Enum.TryParse<DistinguishedFolderIdNameType>(folderName, out folderIdName)) { folderId.Id = folderIdName; } else { Site.Assert.Fail("The value of the first argument (foldIdNameType) of FindItem operation is invalid."); } findRequest.ParentFolderIds = new BaseFolderIdType[1]; findRequest.ParentFolderIds[0] = folderId; PathToUnindexedFieldType itemClass = new PathToUnindexedFieldType(); UnindexedFieldURIType fieldURI; if (Enum.TryParse<UnindexedFieldURIType>(field, out fieldURI)) { // set search field. itemClass.FieldURI = fieldURI; } else { Site.Assert.Fail("The value of the second argument (fieldURIType) of FindItem operation is invalid."); } ContainsExpressionType expressionType = new ContainsExpressionType(); expressionType.Item = itemClass; expressionType.ContainmentMode = ContainmentModeType.Substring; expressionType.ContainmentModeSpecified = true; expressionType.ContainmentComparison = ContainmentComparisonType.IgnoreCaseAndNonSpacingCharacters; expressionType.ContainmentComparisonSpecified = true; expressionType.Constant = new ConstantValueType(); expressionType.Constant.Value = value; RestrictionType restriction = new RestrictionType(); restriction.Item = expressionType; if (!string.IsNullOrEmpty(value)) { findRequest.Restriction = restriction; } return findRequest; }
/// <summary> /// Set related folder properties of create folder request /// </summary> /// <param name="displayNames">Display names of folders that will be set into create folder request.</param> /// <param name="folderClasses">Folder class values of folders that will be set into create folder request.</param> /// <param name="folderPermissions">Folder permission values of folders that will be set into create folder request. </param> /// <param name="createFolderRequest">Create folder request instance that needs to set property values.</param> /// <returns>Create folder request instance that have folder property value configured.</returns> protected CreateFolderType ConfigureFolderProperty(string[] displayNames, string[] folderClasses, PermissionSetType[] folderPermissions, CreateFolderType createFolderRequest) { Site.Assert.IsNotNull(displayNames, "Display names should not be null!"); Site.Assert.IsNotNull(folderClasses, "Folder classes should not be null!"); Site.Assert.AreEqual<int>(displayNames.Length, folderClasses.Length, "Folder names count should equals to folder class value count!"); if (folderPermissions != null) { Site.Assert.AreEqual<int>(displayNames.Length, folderPermissions.Length, "Folder names count should equals to folder permission value count!"); } int folderCount = displayNames.Length; createFolderRequest.Folders = new BaseFolderType[folderCount]; for (int folderPropertyIndex = 0; folderPropertyIndex < folderCount; folderPropertyIndex++) { string folderResourceName = Common.GenerateResourceName(this.Site, displayNames[folderPropertyIndex]); if (folderClasses[folderPropertyIndex] == "IPF.Appointment") { CalendarFolderType calendarFolder = new CalendarFolderType(); calendarFolder.DisplayName = folderResourceName; createFolderRequest.Folders[folderPropertyIndex] = calendarFolder; } else if (folderClasses[folderPropertyIndex] == "IPF.Contact") { ContactsFolderType contactFolder = new ContactsFolderType(); contactFolder.DisplayName = folderResourceName; if (folderPermissions != null) { contactFolder.PermissionSet = folderPermissions[folderPropertyIndex]; } createFolderRequest.Folders[folderPropertyIndex] = contactFolder; } else if (folderClasses[folderPropertyIndex] == "IPF.Task") { TasksFolderType taskFolder = new TasksFolderType(); taskFolder.DisplayName = folderResourceName; if (folderPermissions != null) { taskFolder.PermissionSet = folderPermissions[folderPropertyIndex]; } createFolderRequest.Folders[folderPropertyIndex] = taskFolder; } else if (folderClasses[folderPropertyIndex] == "IPF.Search") { SearchFolderType searchFolder = new SearchFolderType(); searchFolder.DisplayName = folderResourceName; // Set search parameters. searchFolder.SearchParameters = new SearchParametersType(); searchFolder.SearchParameters.Traversal = SearchFolderTraversalType.Deep; searchFolder.SearchParameters.TraversalSpecified = true; searchFolder.SearchParameters.BaseFolderIds = new DistinguishedFolderIdType[1]; DistinguishedFolderIdType inboxType = new DistinguishedFolderIdType(); inboxType.Id = new DistinguishedFolderIdNameType(); inboxType.Id = DistinguishedFolderIdNameType.inbox; searchFolder.SearchParameters.BaseFolderIds[0] = inboxType; // Use the following search filter searchFolder.SearchParameters.Restriction = new RestrictionType(); PathToUnindexedFieldType path = new PathToUnindexedFieldType(); path.FieldURI = UnindexedFieldURIType.itemSubject; RestrictionType restriction = new RestrictionType(); ExistsType isEqual = new ExistsType(); isEqual.Item = path; restriction.Item = isEqual; searchFolder.SearchParameters.Restriction = restriction; if (folderPermissions != null) { searchFolder.PermissionSet = folderPermissions[folderPropertyIndex]; } createFolderRequest.Folders[folderPropertyIndex] = searchFolder; } else { // Set Display Name and Folder Class for the folder to be created. FolderType folder = new FolderType(); folder.DisplayName = folderResourceName; folder.FolderClass = folderClasses[folderPropertyIndex]; if (folderPermissions != null) { folder.PermissionSet = folderPermissions[folderPropertyIndex]; } createFolderRequest.Folders[folderPropertyIndex] = folder; } } return createFolderRequest; }
/// <summary> /// Log on to a mailbox with a specified user account and find the specified folder then update the folder name of it. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="userPassword">Password of the user.</param> /// <param name="userDomain">Domain of the user.</param> /// <param name="parentFolderName">Name of the parent folder.</param> /// <param name="currentFolderName">Current name of the folder which will be updated.</param> /// <param name="newFolderName">New name of the folder which will be updated to.</param> /// <returns>If the name of the folder is updated successfully, return true; otherwise, return false.</returns> public bool FindAndUpdateFolderName(string userName, string userPassword, string userDomain, string parentFolderName, string currentFolderName, string newFolderName) { // Switch to specified user mailbox. bool isSwitched = AdapterHelper.SwitchUser(userName, userPassword, userDomain, this.exchangeServiceBinding, this.Site); Site.Assert.IsTrue( isSwitched, string.Format("Log on mailbox with the UserName: {0}, Password: {1}, Domain: {2} should be successful.", userName, userPassword, userDomain)); // Parse the parent folder name to DistinguishedFolderIdNameType. DistinguishedFolderIdNameType parentFolderIdName = (DistinguishedFolderIdNameType)Enum.Parse(typeof(DistinguishedFolderIdNameType), parentFolderName, true); // Create UpdateFolder request UpdateFolderType updateFolderRequest = new UpdateFolderType(); updateFolderRequest.FolderChanges = new FolderChangeType[1]; updateFolderRequest.FolderChanges[0] = new FolderChangeType(); updateFolderRequest.FolderChanges[0].Item = this.FindSubFolder(parentFolderIdName, currentFolderName); // Identify the field to update and the value to set for it. SetFolderFieldType displayName = new SetFolderFieldType(); PathToUnindexedFieldType displayNameProp = new PathToUnindexedFieldType(); displayNameProp.FieldURI = UnindexedFieldURIType.folderDisplayName; FolderType updatedFolder = new FolderType(); updatedFolder.DisplayName = newFolderName; displayName.Item = displayNameProp; updatedFolder.DisplayName = newFolderName; displayName.Item1 = updatedFolder; // Add a single element into the array of changes. updateFolderRequest.FolderChanges[0].Updates = new FolderChangeDescriptionType[1]; updateFolderRequest.FolderChanges[0].Updates[0] = displayName; bool isFolderNameUpdated = false; // Invoke the UpdateFolder operation and get the response. UpdateFolderResponseType updateFolderResponse = this.exchangeServiceBinding.UpdateFolder(updateFolderRequest); if (updateFolderResponse != null && ResponseClassType.Success == updateFolderResponse.ResponseMessages.Items[0].ResponseClass) { isFolderNameUpdated = true; } return isFolderNameUpdated; }
public void MSOXWSMTGS_S01_TC17_UpdateAndDeleteoccurrenceOfRecurringMeeting() { #region Organizer creates a recurring meeting // Verify DailyRecurrencePatternType and NumberedRecurrenceRangeType. DailyRecurrencePatternType dailyPattern = new DailyRecurrencePatternType(); NumberedRecurrenceRangeType numberedRange = new NumberedRecurrenceRangeType(); numberedRange.NumberOfOccurrences = this.NumberOfOccurrences; // Define a recurring meeting. CalendarItemType meetingItem = this.DefineRecurringMeeting(dailyPattern, numberedRange); Site.Assert.IsNotNull(meetingItem, "The meeting item should be created."); // Create the recurring meeting. ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll); Site.Assert.IsNotNull(item, "The recurring meeting should be created successfully."); #endregion #region Attendee gets the meeting request MeetingRequestMessageType request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType; Site.Assert.IsNotNull(request, "The meeting request message should be found in attendee's Inbox folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendOnlyToAll."); #endregion #region Attendee accepts the meeting request AcceptItemType acceptItem = new AcceptItemType(); acceptItem.ReferenceItemId = new ItemIdType(); acceptItem.ReferenceItemId.Id = request.ItemId.Id; item = this.CreateSingleCalendarItem(Role.Attendee, acceptItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll); Site.Assert.IsNotNull(item, "Accept the meeting request should be successful."); #endregion #region Attendee gets the accepted meeting request. request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.deleteditems, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType; Site.Assert.IsNotNull(request, "The meeting request should exist in attendee's Deleted Items folder after attendee accepts the meeting request."); Site.Assert.IsTrue(request.IsOutOfDateSpecified, "Element IsOutOfDate should be present."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R751"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R751 this.Site.CaptureRequirementIfIsFalse( request.IsOutOfDate, 751, @"[In t:MeetingMessageType Complex Type] otherwise [ there has not been an update to the meeting and the current item in the calendar is not out of date] false."); #endregion #region Organizer gets the calendar item CalendarItemType calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType; Site.Assert.IsNotNull(item, "The calendar item should be found in organizer's Calendar folder."); #endregion #region Organizer deletes one of the occurrences of the recurring meeting OccurrenceItemIdType occurrenceId = new OccurrenceItemIdType(); occurrenceId.RecurringMasterId = calendar.ItemId.Id; occurrenceId.InstanceIndex = 1; DeleteItemType deleteItemRequest = new DeleteItemType(); deleteItemRequest.ItemIds = new BaseItemIdType[] { occurrenceId }; deleteItemRequest.DeleteType = DisposalType.HardDelete; deleteItemRequest.SendMeetingCancellations = CalendarItemCreateOrDeleteOperationType.SendOnlyToAll; deleteItemRequest.SendMeetingCancellationsSpecified = true; DeleteItemResponseType deleteItemResponse = this.MTGSAdapter.DeleteItem(deleteItemRequest); Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType; Site.Assert.IsNotNull(calendar, "The calendar item should exist."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1214"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1214 // SendMeetingCancellationsSpecified is specified as true, and the occurrence is deleted successfully, this requirement can be captured. this.Site.CaptureRequirement( 1214, @"[In Messages] If you are using the proxy objects, make sure that the SendMeetingCancellationsSpecified property is set to true."); #endregion #region Organizer updates one of the occurrences of the recurring meeting occurrenceId = new OccurrenceItemIdType(); occurrenceId.RecurringMasterId = calendar.ItemId.Id; occurrenceId.ChangeKey = calendar.ItemId.ChangeKey; occurrenceId.InstanceIndex = 2; UpdateItemType updateItemRequest = new UpdateItemType(); updateItemRequest.ItemChanges = new ItemChangeType[1]; updateItemRequest.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToAllAndSaveCopy; updateItemRequest.SendMeetingInvitationsOrCancellationsSpecified = true; updateItemRequest.MessageDisposition = MessageDispositionType.SendAndSaveCopy; updateItemRequest.MessageDispositionSpecified = true; updateItemRequest.ConflictResolution = ConflictResolutionType.AlwaysOverwrite; updateItemRequest.ItemChanges[0] = new ItemChangeType(); updateItemRequest.ItemChanges[0].Item = occurrenceId; SetItemFieldType setItemField = new SetItemFieldType(); PathToUnindexedFieldType pathToUnindexed = new PathToUnindexedFieldType(); pathToUnindexed.FieldURI = UnindexedFieldURIType.calendarLocation; setItemField.Item = pathToUnindexed; setItemField.Item1 = new CalendarItemType() { Location = this.LocationUpdate }; updateItemRequest.ItemChanges[0].Updates = new ItemChangeDescriptionType[] { setItemField }; UpdateItemResponseType updateItemResponse = this.MTGSAdapter.UpdateItem(updateItemRequest); Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); #endregion #region Organizer gets the udpated calendar item calendar = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType; #endregion #region Organizer updates the calendar item updateItemRequest.ItemChanges[0].Item = calendar.ItemId; string locationUpdated = Common.GenerateResourceName(this.Site, "NewLocation"); setItemField.Item1 = new CalendarItemType() { Location = locationUpdated }; updateItemRequest.ItemChanges[0].Updates = new ItemChangeDescriptionType[] { setItemField }; updateItemResponse = this.MTGSAdapter.UpdateItem(updateItemRequest); Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); #endregion #region Attendee gets the updated meeting request request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, locationUpdated, meetingItem.UID, UnindexedFieldURIType.calendarLocation) as MeetingRequestMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R345"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R345 this.Site.CaptureRequirementIfAreEqual<int>( 1, request.ModifiedOccurrences.Length, 345, @"[In t:MeetingRequestMessageType Complex Type] ModifiedOccurrences: Contains an array of recurring meeting item occurrences that have been modified so that they are different from the original instances of the recurrence master item."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R347"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R347 this.Site.CaptureRequirementIfAreEqual<int>( 1, request.DeletedOccurrences.Length, 347, @"[In t:MeetingRequestMessageType Complex Type] DeletedOccurrences: Contains an array of deleted occurrences of a recurring meeting item."); #endregion #region Attendee gets the accepted meeting request again. request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.deleteditems, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType; Site.Assert.IsNotNull(request, "The meeting request should exist in attendee's Deleted Items folder after attendee accepts the meeting request."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R750"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R750 this.Site.CaptureRequirementIfIsTrue( request.IsOutOfDate, 750, @"[In t:MeetingMessageType Complex Type] [IsOutOfDate is] True, there has been an update to the meeting and the current item in the calendar is out of date."); #endregion #region Clean up organizer's deleteditems and sentitems folder, and attendee's inbox, calendar and deleteditems folders. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems }); this.CleanupFoldersByRole(Role.Attendee, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.deleteditems }); #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_TC24_CreateItemAssociatedWithFolder() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2285, this.Site), "Exchange 2007 does not support the IsAssociated element."); #region Create an user configuration object. // User configuration objects are items that are associated with folders in a mailbox. string userConfiguratioName = Common.GenerateResourceName(this.Site, "UserConfigurationSampleName").Replace("_", string.Empty); bool isSuccess = this.USRCFGSUTControlAdapter.CreateUserConfiguration( Common.GetConfigurationPropertyValue("User1Name", this.Site), Common.GetConfigurationPropertyValue("User1Password", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site), userConfiguratioName); Site.Assert.IsTrue(isSuccess, "The user configuration object should be created successfully."); #endregion #region Find the created user configuration object FindItemType findRequest = new FindItemType(); findRequest.ItemShape = new ItemResponseShapeType(); findRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; findRequest.ParentFolderIds = new BaseFolderIdType[1] { new DistinguishedFolderIdType() { Id = DistinguishedFolderIdNameType.inbox } }; PathToUnindexedFieldType itemSubject = new PathToUnindexedFieldType(); itemSubject.FieldURI = UnindexedFieldURIType.itemItemClass; ContainsExpressionType expressionType = new ContainsExpressionType(); expressionType.Item = itemSubject; expressionType.ContainmentMode = ContainmentModeType.Substring; expressionType.ContainmentModeSpecified = true; expressionType.ContainmentComparison = ContainmentComparisonType.IgnoreCaseAndNonSpacingCharacters; expressionType.ContainmentComparisonSpecified = true; expressionType.Constant = new ConstantValueType(); expressionType.Constant.Value = "IPM.Configuration"; RestrictionType restriction = new RestrictionType(); restriction.Item = expressionType; findRequest.Restriction = restriction; findRequest.Traversal = ItemQueryTraversalType.Associated; FindItemResponseType findResponse = this.SRCHAdapter.FindItem(findRequest); ItemType[] foundItems = (((FindItemResponseMessageType)findResponse.ResponseMessages.Items[0]).RootFolder.Item as ArrayOfRealItemsType).Items; ItemType item = null; foreach (ItemType foundItem in foundItems) { if (foundItem.ItemClass.Contains(userConfiguratioName)) { item = foundItem; break; } } Site.Assert.IsNotNull(item, "The created user configuration object should be found!"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1618"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1618 this.Site.CaptureRequirementIfIsTrue( item.IsAssociatedSpecified && item.IsAssociated, 1618, @"[In t:ItemType Complex Type] [IsAssociated is] True, indicates the item is associated with a folder."); #endregion }
public void MSOXWSCORE_S01_TC09_VerifyItemWithWithAllElement() { #region Step 1: Create the item. ItemType[] items = new ItemType[1]; items[0] = this.CreateFullPropertiesItem(); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.inbox, items); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created item should be returned. Site.Assert.AreEqual<int>( 1, createdItemIds.GetLength(0), "One created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdItemIds.GetLength(0)); #endregion #region Step 2: Get the item. GetItemType getItem = new GetItemType(); GetItemResponseType getItemResponse = new GetItemResponseType(); // The Item properties returned. getItem.ItemShape = new ItemResponseShapeType(); getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; List<PathToUnindexedFieldType> pathToUnindexedFields = new List<PathToUnindexedFieldType>(); if (Common.IsRequirementEnabled(1354, this.Site)) { PathToUnindexedFieldType pathToUnindexedField = new PathToUnindexedFieldType(); pathToUnindexedField.FieldURI = UnindexedFieldURIType.itemPreview; pathToUnindexedFields.Add(pathToUnindexedField); } if (Common.IsRequirementEnabled(1731, this.Site)) { PathToUnindexedFieldType pathToUnindexedField = new PathToUnindexedFieldType(); pathToUnindexedField.FieldURI = UnindexedFieldURIType.itemTextBody; pathToUnindexedFields.Add(pathToUnindexedField); } if (pathToUnindexedFields.Count > 0) { getItem.ItemShape.AdditionalProperties = pathToUnindexedFields.ToArray(); } // The item to get. getItem.ItemIds = createdItemIds; getItemResponse = this.COREAdapter.GetItem(getItem); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemType[] getItems = Common.GetItemsFromInfoResponse<ItemType>(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItems.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItems.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); ItemIdType[] itemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); ItemIdId itemIdId = this.ITEMIDAdapter.ParseItemId(itemIds[0]); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSITEMID_R63"); // Verify MS-OXWSITEMID requirement: MS-OXWSITEMID_R63 Site.CaptureRequirementIfAreEqual<IdStorageType>( IdStorageType.MailboxItemMailboxGuidBased, itemIdId.StorageType, "MS-OXWSITEMID", 63, @"[In Id Storage Type (byte)] Its [Id Storage Type's] value maps to the following enumeration value. /// <summary> /// Indicates which type of storage is used for the item/folder represented by this Id. /// </summary> internal enum IdStorageType : byte { [ /// <summary> /// The Id represents an item or folder in a mailbox and /// it contains a primary SMTP address. /// </summary> MailboxItemSmtpAddressBased = 0, /// <summary> /// The Id represents a folder in a PublicFolder store. /// </summary> PublicFolder = 1, /// <summary> /// The Id represents an item in a PublicFolder store. /// </summary> PublicFolderItem = 2, ] /// <summary> /// The Id represents an item or folder in a mailbox and contains a mailbox GUID. /// </summary> MailboxItemMailboxGuidBased = 3, [ /// <summary> /// The Id represents a conversation in a mailbox and contains a mailbox GUID. /// </summary> ConversationIdMailboxGuidBased = 4, /// <summary> /// The Id represents (by objectGuid) an object in the Active Directory. /// </summary> ActiveDirectoryObject = 5,] }"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R156"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R156 this.Site.CaptureRequirementIfAreEqual<string>( createdItemIds[0].Id, getItems[0].ItemId.Id, 156, @"[In t:ItemIdType Complex Type] [The attribute ""Id""] Specifies an item identifier."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R298"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R298 // The created item was got successfully, so R298 can be captured. this.Site.CaptureRequirement( 298, @"[In m:CreateItemType Complex Type] [The element ""SavedItemFolderId""] Specifies the folder in which new items are saved."); #endregion #region Capture Code // Verify the ItemIdType. this.VerifyItemIdType(getItems[0].ItemId); // Verify the FolderIdType. this.VerifyFolderIdType(getItems[0].ParentFolderId); // Verify the ItemClassType. this.VerifyItemClassType(getItems[0].ItemClass, items[0].ItemClass); // Verify the Subject. this.VerifySubject(getItems[0].Subject, items[0].Subject); // Verify the SensitivityChoicesType. this.VerifySensitivityChoicesType(getItems[0].Sensitivity, items[0].Sensitivity); // Verify the BodyType. this.VerifyBodyType(getItems[0].Body, items[0].Body); // Verify the ArrayOfStringsType. this.VerifyArrayOfStringsType(getItems[0].Categories, items[0].Categories); // Verify the ImportanceChoicesType. this.VerifyImportanceChoicesType(getItems[0].ImportanceSpecified, getItems[0].Importance, items[0].Importance); // Verify the InReplyTo. this.VerifyInReplyTo(getItems[0].InReplyTo, items[0].InReplyTo); // Verify the NonEmptyArrayOfResponseObjectsType. this.VerifyNonEmptyArrayOfResponseObjectsType(getItems[0].ResponseObjects); // Verify the ReminderDueBy. this.VerifyReminderDueBy(getItems[0].ReminderDueBySpecified, getItems[0].ReminderDueBy, items[0].ReminderDueBy); // Verify the ReminderIsSet. this.VerifyReminderIsSet(getItems[0].ReminderIsSetSpecified); // Verify the DisplyTo. this.VerifyDisplayTo(getItems[0].DisplayTo); // Verify the DisplyCc. this.VerifyDisplayCc(getItems[0].DisplayCc); // Verify the Culture. this.VerifyCulture(getItems[0].Culture, items[0].Culture); // Verify the LastModifiedName. this.VerifyLastModifiedName(getItems[0].LastModifiedName, Common.GetConfigurationPropertyValue("User1Name", this.Site)); // Verify the EffectiveRightsType. this.VerifyEffectiveRightsType(getItems[0].EffectiveRights); // Verify the FlagType. this.VerifyFlagType(getItems[0].Flag); // Verify the Preview. this.VerifyPreview(getItems[0].Preview, getItems[0].Body.Value); // Verify the TextBody. this.VerifyTextBody(getItems[0].TextBody); // Verify the InstanceKey. this.VerifyInstanceKey(getItems[0].InstanceKey); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1315"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1315 Site.CaptureRequirementIfIsTrue( getItems[0].DateTimeReceivedSpecified, 1315, @"[In t:ItemType Complex Type] The type of DateTimeReceived is xs:dateTime [XMLSCHEMA2]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1316"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1316 Site.CaptureRequirementIfIsTrue( getItems[0].SizeSpecified, 1316, @"[In t:ItemType Complex Type] The type of Size is xs:int [XMLSCHEMA2]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1320"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1320 Site.CaptureRequirementIfIsTrue( getItems[0].IsSubmittedSpecified, 1320, @"[In t:ItemType Complex Type] The type of IsSubmitted is xs:boolean [XMLSCHEMA2]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1607"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1607 Site.CaptureRequirementIfIsFalse( getItems[0].IsSubmitted, 1607, @"[In t:ItemType Complex Type] otherwise [IsSubmitted is] false, indicates [an item has not been submitted to the folder]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1321"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1321 Site.CaptureRequirementIfIsTrue( getItems[0].IsDraftSpecified, 1321, @"[In t:ItemType Complex Type] The type of IsDraft is xs:boolean."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1322"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1322 Site.CaptureRequirementIfIsTrue( getItems[0].IsFromMeSpecified, 1322, @"[In t:ItemType Complex Type] The type of IsFromMe is xs:boolean."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1611"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1611 Site.CaptureRequirementIfIsFalse( getItems[0].IsFromMe, 1611, @"[In t:ItemType Complex Type] otherwise [IsFromMe is] false, indicates [a user does not sent an item to himself or herself]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1323"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1323 Site.CaptureRequirementIfIsTrue( getItems[0].IsResendSpecified, 1323, @"[In t:ItemType Complex Type] The type of IsResend is xs:boolean."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1613"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1613 Site.CaptureRequirementIfIsFalse( getItems[0].IsResend, 1613, @"[In t:ItemType Complex Type] otherwise [IsResend is] false, indicates [an item has not previously been sent]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1324"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1324 Site.CaptureRequirementIfIsTrue( getItems[0].IsUnmodifiedSpecified, 1324, @"[In t:ItemType Complex Type] The type of IsUnmodified is xs:boolean."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1326"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1326 Site.CaptureRequirementIfIsTrue( getItems[0].DateTimeSentSpecified, 1326, @"[In t:ItemType Complex Type] The type of DateTimeSent is xs:dateTime."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1327"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1327 Site.CaptureRequirementIfIsTrue( getItems[0].DateTimeCreatedSpecified, 1327, @"[In t:ItemType Complex Type] The type of DateTimeCreated is xs:dateTime."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1335"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1335 Site.CaptureRequirementIfIsTrue( getItems[0].HasAttachmentsSpecified, 1335, @"[In t:ItemType Complex Type] The type of HasAttachments is xs:boolean."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1340"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1340 Site.CaptureRequirementIfIsTrue( getItems[0].LastModifiedTimeSpecified, 1340, @"[In t:ItemType Complex Type] The type of LastModifiedTime is xs:dateTime."); // Verify the ReminderMinutesBeforeStartType schema. this.VerifyReminderMinutesBeforeStartType(getItems[0].ReminderMinutesBeforeStart, items[0].ReminderMinutesBeforeStart); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R105"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R105 // The LastModifiedTimeSpecified is true, so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( getItems[0].LastModifiedTimeSpecified, 105, @"[In t:ItemType Complex Type] [The element ""LastModifiedTime""] Specifies an instance of the DateTime structure that represents the date and time when an item was last modified."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R78"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R78 // The DateTimeReceivedSpecified is true, so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( getItems[0].DateTimeReceivedSpecified, 78, @"[In t:ItemType Complex Type] [The element ""DateTimeReceived""] Specifies the date and time that an item was received in a mailbox."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R79"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R79 // The SizeSpecified is true, so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( getItems[0].SizeSpecified, 79, @"[In t:ItemType Complex Type] [The element ""Size""] Specifies an integer value that represents the size of an item, in bytes."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R89"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R89 // The DateTimeSentSpecified is true, so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( getItems[0].DateTimeSentSpecified, 89, @"[In t:ItemType Complex Type] [The element ""DateTimeSent""] Specifies the date and time when an item in a mailbox was sent."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R90"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R90 // The DateTimeCreatedSpecified is true, so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( getItems[0].DateTimeCreatedSpecified, 90, @"[In t:ItemType Complex Type] [The element ""DateTimeCreated""] Specifies the date and time when an item in a mailbox was created."); if (Common.IsRequirementEnabled(4003, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R4003"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R4003 // The IsTruncated is set and the item is created successfully, so this requirement can be captured. this.Site.CaptureRequirement( "MS-OXWSCDATA", 4003, @"[In Appendix C: Product Behavior] Implementation does use the attribute ""IsTruncated"" with type ""xs:boolean ([XMLSCHEMA2])"" which specifies whether the body is truncated. (Exchange 2013 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(1353, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1353"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1353 // The RetentionDate is set and the item is created successfully, so this requirement can be captured. this.Site.CaptureRequirement( 1353, @"[In Appendix C: Product Behavior] Implementation does support element ""RetentionDate"" with type ""xs:dateTime"" which specifies the retention date for an item. (Exchange 2013 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(2281, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1314"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1314 // The Attachments is set and the item is created successfully, so this requirement can be captured. this.Site.CaptureRequirement( 1314, @"[In t:ItemType Complex Type] The type of Attachments is t:NonEmptyArrayOfAttachmentsType ([MS-OXWSCDATA] section 2.2.4.43)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2281"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2281 // The Attachments is set and the item is created successfully, so this requirement can be captured. this.Site.CaptureRequirement( 2281, @"[In Appendix C: Product Behavior] Implementation does use the Attachments element which specifies an array of items or files that are attached to an item. (Exchange 2010 SP2 and above follow this behavior.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1620"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1620 this.Site.CaptureRequirementIfIsTrue( getItems[0].HasAttachmentsSpecified && getItems[0].HasAttachments, 1620, @"[In t:ItemType Complex Type] [HasAttachments is] True, indicates an item has at least one attachment."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1229"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1229 this.Site.CaptureRequirement( "MS-OXWSCDATA", 1229, @"[In t:NonEmptyArrayOfAttachmentsType Complex Type] The type [NonEmptyArrayOfAttachmentsType] is defined as follow: <xs:complexType name=""NonEmptyArrayOfAttachmentsType""> <xs:choice minOccurs=""1"" maxOccurs=""unbounded"" > <xs:element name=""ItemAttachment"" type=""t:ItemAttachmentType"" /> <xs:element name=""FileAttachment"" type=""t:FileAttachmentType"" /> </xs:choice> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1633"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1633 // The item was created with an item attachment. this.Site.CaptureRequirement( "MS-OXWSCDATA", 1633, @"[In t:NonEmptyArrayOfAttachmentsType Complex Type] The element ""ItemAttachment"" is ""t:ItemAttachmentType"" type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1634"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1634 // The item was created with an file attachment. this.Site.CaptureRequirement( "MS-OXWSCDATA", 1634, @"[In t:NonEmptyArrayOfAttachmentsType Complex Type] The element ""FileAttachment"" is ""t:FileAttachmentType"" type."); } if (Common.IsRequirementEnabled(2285, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2285"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2285 this.Site.CaptureRequirementIfIsTrue( getItems[0].IsAssociatedSpecified, 2285, @"[In Appendix C: Product Behavior] Implementation does support the IsAssociated element which specifies a value that indicates whether the item is associated with a folder. (Exchange 2010 and above follow this behavior.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1619"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1619 this.Site.CaptureRequirementIfIsFalse( getItems[0].IsAssociated, 1619, @"[In t:ItemType Complex Type] otherwise [IsAssociated is] false, indicates [the item is associated with a folder]."); } if (Common.IsRequirementEnabled(2338, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2338"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2338 this.Site.CaptureRequirementIfIsNotNull( getItems[0].WebClientReadFormQueryString, 2338, @"[In Appendix C: Product Behavior] Implementation does support the WebClientReadFormQueryString element. (Exchange Server 2010 and above follow this behavior.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1342"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1342 // The WebClientReadFormQueryString is returned from server and pass the schema validation, so this requirement can be captured. this.Site.CaptureRequirement( 1342, @"[In t:ItemType Complex Type] The type of WebClientReadFormQueryString is xs:string."); } if (Common.IsRequirementEnabled(2283, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2283"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2283 this.Site.CaptureRequirementIfIsTrue( getItems[0].ReminderNextTimeSpecified, 2283, @"[In Appendix C: Product Behavior] Implementation does support the ReminderNextTime element which specifies the date and time for the next reminder. (Exchange 2013 and above follow this behavior.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1727"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1727 // The ReminderNextTime is returned from server and pass the schema validation, so this requirement can be captured. this.Site.CaptureRequirement( 1727, @"[In t:ItemType Complex Type] The type of ReminderNextTime is xs:dateTime."); } if (Common.IsRequirementEnabled(2288, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2288"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2288 this.Site.CaptureRequirementIfIsNotNull( getItems[0].ConversationId, 2288, @"[In Appendix C: Product Behavior] Implementation does support the element ""ConversationId"" which specifies the ID of the conversation that an item is part of.. (Exchange 2010 and above follow this behavior.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1344"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1344 // The ConversationId is returned from server and pass the schema validation, so this requirement can be captured. this.Site.CaptureRequirement( 1344, @"[In t:ItemType Complex Type] The type of ConversationId is t:ItemIdType."); } #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 }