public void MSOXWSFOLD_S06_TC07_UpdateFolderFailed() { #region Create a new folder in the inbox folder // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newFolderId); #endregion #region Delete the created folder // DeleteFolder request. DeleteFolderType deleteFolderRequest = this.GetDeleteFolderRequest(DisposalType.HardDelete, newFolderId); // Delete the specified folder. DeleteFolderResponseType deleteFolderResponse = this.FOLDAdapter.DeleteFolder(deleteFolderRequest); // Check the response. Common.CheckOperationSuccess(deleteFolderResponse, 1, this.Site); // The folder has been deleted, so its folder id has disappeared. this.NewCreatedFolderIds.Remove(newFolderId); #endregion #region Move the deleted folder UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", newFolderId); UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4645"); this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Error, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 4645, @"[In UpdateFolder Operation]An unsuccessful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseClass attribute of the UpdateFolderResponseMessage element set to ""Error""."); #endregion }
public void MSOXWSFOLD_S06_TC02_UpdateFolderWithAppendToFolderFieldType() { #region Create a new folder in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); FolderIdType folderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderId); #endregion #region Update Folder Operation with AppendToFolderFieldType Complex Type set. // Specified folder to be updated. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "AppendToFolderField", folderId); // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the length. Site.Assert.AreEqual <int>( 1, updateFolderResponse.ResponseMessages.Items.GetLength(0), "Expected Item Count: {0}, Actual Item Count: {1}", 1, updateFolderResponse.ResponseMessages.Items.GetLength(0)); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R507"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R507. Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Error, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 507, @"[In t:AppendToFolderFieldType Complex Type]Any request that uses this complex type will always return an error response."); #endregion }
public void MSOXWSFOLD_S06_TC06_UpdateDistinguishedFolder() { #region Get the sent items folder. DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.sentitems; // GetFolder request. GetFolderType getSentItemsFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId); GetFolderResponseType getSentItemsFolderResponse = this.FOLDAdapter.GetFolder(getSentItemsFolderRequest); // Check the response. Common.CheckOperationSuccess(getSentItemsFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getSentItemsFolderResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion #region Update Folder Operation. // UpdateFolder request to delete folder permission value. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "DeleteFolderField", folderInfo.FolderId); // Set change key value. folderId.ChangeKey = folderInfo.FolderId.ChangeKey; updateFolderRequest.FolderChanges[0].Item = folderId; // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9101"); // Distinguished folder id set and update folder return a successfully, this requirement can be captured. this.Site.CaptureRequirement( 9101, @"[In t:FolderChangeType Complex Type]DistinguishedFolderId specifies an identifier for a distinguished folder."); }
/// <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); }
/// <summary> /// Modify properties of an existing folder in the server store. /// </summary> /// <param name="request">Request of UpdateFolder.</param> /// <returns>Response of UpdateFolder operation.</returns> public UpdateFolderResponseType UpdateFolder(UpdateFolderType request) { // Send the request and get the response. UpdateFolderResponseType response = this.exchangeServiceBinding.UpdateFolder(request); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); if (ResponseClassType.Success == response.ResponseMessages.Items[0].ResponseClass) { this.VerifyUpdateFolderResponse(this.exchangeServiceBinding.IsSchemaValidated); this.VerifyAllRelatedRequirements(this.exchangeServiceBinding.IsSchemaValidated, response); } // Verify transport type related requirement. this.VerifyTransportType(); // Verify soap version. this.VerifySoapVersion(); return(response); }
public void MSOXWSFOLD_S08_TC01_AllOperationsWithAllOptionalElements() { #region Configure SOAP header this.ConfigureSOAPHeader(); #endregion #region Create new folders in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest( DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder1", "Custom Folder2", "Custom Folder3", "Custom Folder4" }, new string[] { "IPF.MyCustomFolderClass", "IPF.Appointment", "IPF.Contact", "IPF.Task" }, null); // Set ExtendedProperty defined in BaseFolderType. PathToExtendedFieldType publishInAddressBook = new PathToExtendedFieldType(); // A hexadecimal tag of the extended property. publishInAddressBook.PropertyTag = "0x671E"; publishInAddressBook.PropertyType = MapiPropertyTypeType.Boolean; ExtendedPropertyType pubAddressbook = new ExtendedPropertyType(); pubAddressbook.ExtendedFieldURI = publishInAddressBook; pubAddressbook.Item = "1"; ExtendedPropertyType[] extendedProperties = new ExtendedPropertyType[1]; extendedProperties[0] = pubAddressbook; createFolderRequest.Folders[0].ExtendedProperty = extendedProperties; createFolderRequest.Folders[1].ExtendedProperty = extendedProperties; createFolderRequest.Folders[2].ExtendedProperty = extendedProperties; createFolderRequest.Folders[3].ExtendedProperty = extendedProperties; // Define a permissionSet with all optional elements PermissionSetType permissionSet = new PermissionSetType(); permissionSet.Permissions = new PermissionType[1]; permissionSet.Permissions[0] = new PermissionType(); permissionSet.Permissions[0].ReadItems = new PermissionReadAccessType(); permissionSet.Permissions[0].ReadItems = PermissionReadAccessType.FullDetails; permissionSet.Permissions[0].ReadItemsSpecified = true; permissionSet.Permissions[0].CanCreateItems = true; permissionSet.Permissions[0].CanCreateItemsSpecified = true; permissionSet.Permissions[0].CanCreateSubFolders = true; permissionSet.Permissions[0].CanCreateSubFoldersSpecified = true; permissionSet.Permissions[0].IsFolderVisible = true; permissionSet.Permissions[0].IsFolderVisibleSpecified = true; permissionSet.Permissions[0].IsFolderContact = true; permissionSet.Permissions[0].IsFolderContactSpecified = true; permissionSet.Permissions[0].IsFolderOwner = true; permissionSet.Permissions[0].IsFolderOwnerSpecified = true; permissionSet.Permissions[0].IsFolderContact = true; permissionSet.Permissions[0].IsFolderContactSpecified = true; permissionSet.Permissions[0].EditItems = new PermissionActionType(); permissionSet.Permissions[0].EditItems = PermissionActionType.All; permissionSet.Permissions[0].EditItemsSpecified = true; permissionSet.Permissions[0].DeleteItems = new PermissionActionType(); permissionSet.Permissions[0].DeleteItems = PermissionActionType.All; permissionSet.Permissions[0].DeleteItemsSpecified = true; permissionSet.Permissions[0].PermissionLevel = new PermissionLevelType(); permissionSet.Permissions[0].PermissionLevel = PermissionLevelType.Custom; permissionSet.Permissions[0].UserId = new UserIdType(); permissionSet.Permissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); // Set PermissionSet for FolderType folder. ((FolderType)createFolderRequest.Folders[0]).PermissionSet = permissionSet; // Set PermissionSet for ContactsType folder. ((ContactsFolderType)createFolderRequest.Folders[2]).PermissionSet = permissionSet; // Set PermissionSet for TasksFolderType folder. ((TasksFolderType)createFolderRequest.Folders[3]).PermissionSet = permissionSet; // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 4, this.Site); // Folder ids. FolderIdType[] folderIds = new FolderIdType[createFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < createFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, createFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be created successfully!"); // Save folder ids. folderIds[index] = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderIds[index]); } #endregion #region Create a managedfolder CreateManagedFolderRequestType createManagedFolderRequest = this.GetCreateManagedFolderRequest(Common.GetConfigurationPropertyValue("ManagedFolderName1", this.Site)); // Add an email address into request. EmailAddressType mailBox = new EmailAddressType() { EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) }; createManagedFolderRequest.Mailbox = mailBox; // Create the specified managed folder. CreateManagedFolderResponseType createManagedFolderResponse = this.FOLDAdapter.CreateManagedFolder(createManagedFolderRequest); // Check the response. Common.CheckOperationSuccess(createManagedFolderResponse, 1, this.Site); // Save the new created managed folder's folder id. FolderIdType newFolderId = ((FolderInfoResponseMessageType)createManagedFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newFolderId); #endregion #region Get the new created folders // GetFolder request. GetFolderType getCreatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderIds); // Get the new created folder. GetFolderResponseType getCreatedFolderResponse = this.FOLDAdapter.GetFolder(getCreatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getCreatedFolderResponse, 4, this.Site); for (int index = 0; index < getCreatedFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, getCreatedFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder information should be returned!"); } #endregion #region Update the new created folders // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest( new string[] { "Folder", "CalendarFolder", "ContactsFolder", "TasksFolder" }, new string[] { "SetFolderField", "SetFolderField", "SetFolderField", "SetFolderField" }, folderIds); // Update the folders' properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 4, this.Site); for (int index = 0; index < updateFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Copy the updated folders to "drafts" folder // Copy the folders into "drafts" folder CopyFolderType copyFolderRequest = this.GetCopyFolderRequest(DistinguishedFolderIdNameType.drafts.ToString(), folderIds); // Copy the folders. CopyFolderResponseType copyFolderResponse = this.FOLDAdapter.CopyFolder(copyFolderRequest); // Check the response. Common.CheckOperationSuccess(copyFolderResponse, 4, this.Site); // Copied Folders' id. FolderIdType[] copiedFolderIds = new FolderIdType[copyFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < copyFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, copyFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); // Variable to save the folders. copiedFolderIds[index] = ((FolderInfoResponseMessageType)copyFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the copied folders' folder id. this.NewCreatedFolderIds.Add(copiedFolderIds[index]); } #endregion #region Move the updated folders to "deleteditems" folder // MoveFolder request. MoveFolderType moveFolderRequest = new MoveFolderType(); // Set the request's folderId field. moveFolderRequest.FolderIds = folderIds; // Set the request's destFolderId field. DistinguishedFolderIdType toFolderId = new DistinguishedFolderIdType(); toFolderId.Id = DistinguishedFolderIdNameType.deleteditems; moveFolderRequest.ToFolderId = new TargetFolderIdType(); moveFolderRequest.ToFolderId.Item = toFolderId; // Move the specified folders. MoveFolderResponseType moveFolderResponse = this.FOLDAdapter.MoveFolder(moveFolderRequest); // Check the response. Common.CheckOperationSuccess(moveFolderResponse, 4, this.Site); for (int index = 0; index < moveFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, moveFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Delete all folders // All folder ids. FolderIdType[] allFolderIds = new FolderIdType[folderIds.Length + copiedFolderIds.Length]; for (int index = 0; index < allFolderIds.Length / 2; index++) { allFolderIds[index] = folderIds[index]; allFolderIds[index + folderIds.Length] = copiedFolderIds[index]; } // DeleteFolder request. DeleteFolderType deleteFolderRequest = this.GetDeleteFolderRequest(DisposalType.HardDelete, allFolderIds); // Delete the specified folder. DeleteFolderResponseType deleteFolderResponse = this.FOLDAdapter.DeleteFolder(deleteFolderRequest); // Check the response. Common.CheckOperationSuccess(deleteFolderResponse, 8, this.Site); for (int index = 0; index < deleteFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, deleteFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion }
public void MSOXWSFOLD_S08_TC02_AllOperationsWithoutAllOptionalElements() { #region Create new folders in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest( DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder1", "Custom Folder2", "Custom Folder3", "Custom Folder4" }, new string[] { "IPF.MyCustomFolderClass", "IPF.Appointment", "IPF.Contact", "IPF.Task" }, null); // Remove FolderClass for FolderType folder. createFolderRequest.Folders[0].FolderClass = null; // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 4, this.Site); // Folder ids. FolderIdType[] folderIds = new FolderIdType[createFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < createFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, createFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be created successfully!"); // Save folder ids. folderIds[index] = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderIds[index]); } #endregion #region Create a managedfolder CreateManagedFolderRequestType createManagedFolderRequest = this.GetCreateManagedFolderRequest(Common.GetConfigurationPropertyValue("ManagedFolderName1", this.Site)); // Create the specified managed folder. CreateManagedFolderResponseType createManagedFolderResponse = this.FOLDAdapter.CreateManagedFolder(createManagedFolderRequest); // Check the response. Common.CheckOperationSuccess(createManagedFolderResponse, 1, this.Site); // Save the new created managed folder's folder id. FolderIdType newManagedFolderId = ((FolderInfoResponseMessageType)createManagedFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newManagedFolderId); #endregion #region Get the new created folders // GetFolder request. GetFolderType getCreatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderIds); // Get the new created folder. GetFolderResponseType getCreatedFolderResponse = this.FOLDAdapter.GetFolder(getCreatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getCreatedFolderResponse, 4, this.Site); for (int index = 0; index < getCreatedFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, getCreatedFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder information should be returned!"); } #endregion #region Update the new created folders // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest( new string[] { "Folder", "CalendarFolder", "ContactsFolder", "TasksFolder" }, new string[] { "SetFolderField", "SetFolderField", "SetFolderField", "SetFolderField" }, folderIds); // Update the folders' properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 4, this.Site); for (int index = 0; index < updateFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Copy the updated folders to "drafts" folder // Copy the folders into "drafts" folder CopyFolderType copyFolderRequest = this.GetCopyFolderRequest(DistinguishedFolderIdNameType.drafts.ToString(), folderIds); // Copy the folders. CopyFolderResponseType copyFolderResponse = this.FOLDAdapter.CopyFolder(copyFolderRequest); // Check the response. Common.CheckOperationSuccess(copyFolderResponse, 4, this.Site); // Copied folders' id. FolderIdType[] copiedFolderIds = new FolderIdType[copyFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < copyFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, copyFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); // Variable to save the folders. copiedFolderIds[index] = ((FolderInfoResponseMessageType)copyFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the copied folders' folder id. this.NewCreatedFolderIds.Add(copiedFolderIds[index]); } #endregion #region Move the updated folders to "deleteditems" folder // MoveFolder request. MoveFolderType moveFolderRequest = new MoveFolderType(); // Set the request's folderId field. moveFolderRequest.FolderIds = folderIds; // Set the request's destFolderId field. DistinguishedFolderIdType toFolderId = new DistinguishedFolderIdType(); toFolderId.Id = DistinguishedFolderIdNameType.deleteditems; moveFolderRequest.ToFolderId = new TargetFolderIdType(); moveFolderRequest.ToFolderId.Item = toFolderId; // Move the specified folders. MoveFolderResponseType moveFolderResponse = this.FOLDAdapter.MoveFolder(moveFolderRequest); // Check the response. Common.CheckOperationSuccess(moveFolderResponse, 4, this.Site); for (int index = 0; index < moveFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, moveFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Delete all folders // All folder ids. FolderIdType[] allFolderIds = new FolderIdType[folderIds.Length + copiedFolderIds.Length]; for (int index = 0; index < allFolderIds.Length / 2; index++) { allFolderIds[index] = folderIds[index]; allFolderIds[index + folderIds.Length] = copiedFolderIds[index]; } // DeleteFolder request. DeleteFolderType deleteFolderRequest = this.GetDeleteFolderRequest(DisposalType.HardDelete, allFolderIds); // Delete the specified folder. DeleteFolderResponseType deleteFolderResponse = this.FOLDAdapter.DeleteFolder(deleteFolderRequest); // Check the response. Common.CheckOperationSuccess(deleteFolderResponse, 8, this.Site); for (int index = 0; index < deleteFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, deleteFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion }
public void MSOXWSFOLD_S06_TC05_UpdateFolderWithMultipleProperties() { #region Create a new folder in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); FolderIdType folderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderId); #endregion #region Update Folder Operation. // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", folderId); // In order to verify MS-OXWSCDATA_R335, add another property(PermissionSet) into UpdateFolder request. FolderType updatingFolder = (FolderType)((SetFolderFieldType)updateFolderRequest.FolderChanges[0].Updates[0]).Item1; updatingFolder.PermissionSet = new PermissionSetType(); updatingFolder.PermissionSet.Permissions = new PermissionType[1]; updatingFolder.PermissionSet.Permissions[0] = new PermissionType(); updatingFolder.PermissionSet.Permissions[0].CanCreateSubFolders = true; updatingFolder.PermissionSet.Permissions[0].CanCreateSubFoldersSpecified = true; updatingFolder.PermissionSet.Permissions[0].IsFolderOwner = true; updatingFolder.PermissionSet.Permissions[0].IsFolderOwnerSpecified = true; updatingFolder.PermissionSet.Permissions[0].PermissionLevel = new PermissionLevelType(); updatingFolder.PermissionSet.Permissions[0].PermissionLevel = PermissionLevelType.Custom; updatingFolder.PermissionSet.Permissions[0].UserId = new UserIdType(); updatingFolder.PermissionSet.Permissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the length. Site.Assert.AreEqual <int>( 1, updateFolderResponse.ResponseMessages.Items.GetLength(0), "Expected Item Count: {0}, Actual Item Count: {1}", 1, updateFolderResponse.ResponseMessages.Items.GetLength(0)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R335"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R335 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.ErrorIncorrectUpdatePropertyCount, updateFolderResponse.ResponseMessages.Items[0].ResponseCode, "MS-OXWSCDATA", 335, @"[In m:ResponseCodeType Simple Type] The value ""ErrorIncorrectUpdatePropertyCount"" specifies that each change description in an UpdateItem or UpdateFolder method call MUST list only one property to be updated."); #endregion }
public void MSOXWSFOLD_S06_TC01_UpdateFolder() { #region Create a new folder in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); FolderIdType folderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderId); #endregion #region Update Folder Operation. // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", folderId); // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site); string updateNameInRequest = ((SetFolderFieldType)updateFolderRequest.FolderChanges[0].Updates[0]).Item1.DisplayName; #endregion #region Get the updated folder. // GetFolder request. GetFolderType getUpdatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId); // Get the updated folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getUpdatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 1, this.Site); FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0]; FolderType gotFolderInfo = (FolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R46444"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R46444 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 46444, @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseClass attribute of the UpdateFolderResponseMessage element set to ""Success""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4644"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4644 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, updateFolderResponse.ResponseMessages.Items[0].ResponseCode, 4644, @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseCode element of the UpdateFolderResponse element set to ""NoError""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8902"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R8902 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 8902, @"[In t:FolderChangeType Complex Type]FolderId specifies the folder identifier and change key."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R582"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R582 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 582, @"[In m:UpdateFolderType Complex Type]The UpdateFolderType complex type specifies a request message to update folders in a mailbox. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R534"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R534 // Set a property on a FolderType folder successfully, indicates that Folder represents a regular folder. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 534, @"[In t:SetFolderFieldType Complex Type]Folder represents a regular folder in the server database."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9301"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9301 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 9301, @"[In t:FolderChangeType Complex Type][Updates] Specifies a collection of changes to a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R546"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R546 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 546, @"[In t:FolderChangeType Complex Type]The FolderChangeType complex type specifies a collection of changes to be performed on a single folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5051"); // All folders updated successfully! this.Site.CaptureRequirement( 5051, @"[In m:UpdateFolderType Complex Type]FolderChanges represents an array of folders to be updated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R531"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R531 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 531, @"[In t:NonEmptyArrayOfFolderChangesType Complex Type]FolderChange represents a collection of changes to be performed on a single folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5251"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5251 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 5251, @"[In t:NonEmptyArrayOfFolderChangeDescriptionsType Complex Type]SetFolderField represents an UpdateFolder operation to set a property on an existing folder."); }
public void MSOXWSFOLD_S06_TC04_UpdateFolderWithDeleteFolderFieldType() { #region Create a new folder in the inbox folder // Configure permission set. PermissionSetType permissionSet = new PermissionSetType(); permissionSet.Permissions = new PermissionType[1]; permissionSet.Permissions[0] = new PermissionType(); permissionSet.Permissions[0].CanCreateSubFolders = true; permissionSet.Permissions[0].CanCreateSubFoldersSpecified = true; permissionSet.Permissions[0].IsFolderOwner = true; permissionSet.Permissions[0].IsFolderOwnerSpecified = true; permissionSet.Permissions[0].PermissionLevel = new PermissionLevelType(); permissionSet.Permissions[0].PermissionLevel = PermissionLevelType.Custom; permissionSet.Permissions[0].UserId = new UserIdType(); permissionSet.Permissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, new PermissionSetType[] { permissionSet }); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newFolderId); #endregion #region Update Folder Operation. // UpdateFolder request to delete folder permission value. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "DeleteFolderField", newFolderId); // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site); #endregion #region Switch user this.SwitchUser(Common.GetConfigurationPropertyValue("User2Name", this.Site), Common.GetConfigurationPropertyValue("User2Password", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site)); #endregion #region Create a subfolder under the folder created in step 1 with User2's credential // CreateFolder request. CreateFolderType createFolderInSharedMailboxRequest = this.GetCreateFolderRequest(newFolderId.Id, new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderInSharedMailboxResponse = this.FOLDAdapter.CreateFolder(createFolderInSharedMailboxRequest); // Check the length. Site.Assert.AreEqual <int>( 1, createFolderInSharedMailboxResponse.ResponseMessages.Items.GetLength(0), "Expected Item Count: {0}, Actual Item Count: {1}", 1, createFolderInSharedMailboxResponse.ResponseMessages.Items.GetLength(0)); // Permission have been deleted so create operation should be failed. bool isPermissionDeleted = createFolderInSharedMailboxResponse.ResponseMessages.Items[0].ResponseClass.Equals(ResponseClassType.Error); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R583"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R583 // One permission set which set in CreateFolder is deleted when calling UpdateFolder. this.Site.CaptureRequirementIfIsTrue( isPermissionDeleted, 583, @"[In t:DeleteFolderFieldType Complex Type]The DeleteFolderFieldType complex type represents an UpdateFolder operation to delete a property from a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5261"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5261 this.Site.CaptureRequirementIfIsTrue( isPermissionDeleted, 5261, @"[In t:NonEmptyArrayOfFolderChangeDescriptionsType Complex Type]DeleteFolderField represents an UpdateFolder operation to delete a property from a folder."); }
public void MSOXWSFOLD_S06_TC03_UpdateMultipleFolders() { #region Create a new folder in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest( DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder1", "Custom Folder2", "Custom Folder3", "Custom Folder4" }, new string[] { "IPF.Appointment", "IPF.Contact", "IPF.Task", "IPF.Search" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 4, this.Site); FolderIdType folderId1 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; FolderIdType folderId2 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[1]).Folders[0].FolderId; FolderIdType folderId3 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[2]).Folders[0].FolderId; FolderIdType folderId4 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[3]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderId1); this.NewCreatedFolderIds.Add(folderId2); this.NewCreatedFolderIds.Add(folderId3); this.NewCreatedFolderIds.Add(folderId4); #endregion #region Update Folder Operation. // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest( new string[] { "CalendarFolder", "ContactsFolder", "TasksFolder", "SearchFolder" }, new string[] { "SetFolderField", "SetFolderField", "SetFolderField", "SetFolderField" }, new FolderIdType[] { folderId1, folderId2, folderId3, folderId4 }); // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 4, this.Site); #endregion #region Get the updated folder. // GetFolder request. GetFolderType getUpdatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId1, folderId2, folderId3, folderId4); // Get the updated folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getUpdatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 4, this.Site); FolderInfoResponseMessageType allPropertyOfSearchFolder = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[3]; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R33"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R33 this.Site.CaptureRequirementIfIsInstanceOfType( allPropertyOfSearchFolder.Folders[0], typeof(SearchFolderType), 33, @"[In t:ArrayOfFoldersType Complex Type]The type of element SearchFolder is t:SearchFolderType ([MS-OXWSSRCH] section 2.2.3.26)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3302"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3302 this.Site.CaptureRequirementIfIsInstanceOfType( allPropertyOfSearchFolder.Folders[0], typeof(SearchFolderType), 3302, @"[In t:ArrayOfFoldersType Complex Type]SearchFolder represents a search folder that is contained in a mailbox."); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R536"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R536 // Set a property on a CalendarFolderType folder successfully, indicates that Folder represents a regular folder. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 536, @"[In t:SetFolderFieldType Complex Type]CalendarFolder represents a folder that primarily contains calendar items. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R538"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R538 // Set a property on a ContactFolderType folder successfully, indicates that Folder represents a regular folder. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[1].ResponseClass, 538, @"[In t:SetFolderFieldType Complex Type]ContactsFolder represents a Contacts folder in a mailbox. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R542"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R542 // Set a property on a TaskFolderType folder successfully, indicates that Folder represents a regular folder. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[2].ResponseClass, 542, @"[In t:SetFolderFieldType Complex Type]TasksFolder represents a Tasks folder that is contained in a mailbox. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R540"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R540 // Set a property on a SearchFolderType folder successfully, indicates that Folder represents a regular folder. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[3].ResponseClass, 540, @"[In t:SetFolderFieldType Complex Type]SearchFolder represents a search folder that is contained in a mailbox. "); }