public void MSOXWSFOLD_S04_TC09_GetFolderIdOnly() { #region Get the contacts folder. DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.contacts; // GetFolder request. GetFolderType getContactsFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.IdOnly, folder); // Get the Contacts folder. GetFolderResponseType getContactsFolderResponse = this.FOLDAdapter.GetFolder(getContactsFolderRequest); // Check the response. Common.CheckOperationSuccess(getContactsFolderResponse, 1, this.Site); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R42103"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R42103 bool isVerifiedR42103 = Common.IsIdOnly((XmlElement)this.FOLDAdapter.LastRawResponseXml, "t:ContactsFolder", "t:FolderId"); this.Site.CaptureRequirementIfIsTrue( isVerifiedR42103, 42103, @"[In t:DefaultShapeNamesType Simple Type] A value of ""IdOnly"" [in DefaultShapeNamesType] specifies only the item or folder ID. include in the response."); }
public void MSOXWSFOLD_S04_TC05_GetNotesFolder() { #region Get the notes folder. DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.notes; // GetFolder request. GetFolderType getNotesFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the notes folder. GetFolderResponseType getNotesFolderResponse = this.FOLDAdapter.GetFolder(getNotesFolderRequest); // Check the response. Common.CheckOperationSuccess(getNotesFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getNotesFolderResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R588."); // Verify MS-OXWSFOLD_R588. Site.CaptureRequirementIfAreEqual <string>( "IPF.StickyNote", folderInfo.FolderClass, 588, @"[In t:BaseFolderType Complex Type]This value[FolderClass] MUST be ""IPF.StickyNote"" for note folders."); }
/// <summary> /// Get folders, Calendar folders, Contacts folders, Tasks folders, and search folders. /// </summary> /// <param name="request">Request of GetFolder operation.</param> /// <returns>Response of GetFolder operation.</returns> public GetFolderResponseType GetFolder(GetFolderType request) { // Send the request and get the response. GetFolderResponseType response = this.exchangeServiceBinding.GetFolder(request); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); return(response); }
public void MSOXWSFOLD_S04_TC06_GetTasksFolder() { #region Get the tasks folder. DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.tasks; // GetFolder request. GetFolderType getTasksFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the tasks folder. GetFolderResponseType getTasksFolderResponse = this.FOLDAdapter.GetFolder(getTasksFolderRequest); // Check the response. Common.CheckOperationSuccess(getTasksFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getTasksFolderResponse.ResponseMessages.Items[0]; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R35"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R35 this.Site.CaptureRequirementIfIsInstanceOfType( allFolders.Folders[0], typeof(TasksFolderType), 35, @"[In t:ArrayOfFoldersType Complex Type]The type of element TasksFolder is t:TasksFolderType ([MS-OXWSTASK] section 2.2.4.5)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3501"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3501 this.Site.CaptureRequirementIfIsInstanceOfType( allFolders.Folders[0], typeof(TasksFolderType), 3501, @"[In t:ArrayOfFoldersType Complex Type]TasksFolder represents a Tasks folder that is contained in a mailbox."); TasksFolderType folderInfo = (TasksFolderType)allFolders.Folders[0]; #endregion // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R589."); // Verify MS-OXWSFOLD_R589. Site.CaptureRequirementIfAreEqual <string>( "IPF.Task", folderInfo.FolderClass, 589, @"[In t:BaseFolderType Complex Type]This value[FolderClass] MUST be ""IPF.Task"" for Tasks folders."); }
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> /// Get folders, Calendar folders, Contacts folders, Tasks folders, and search folders. /// </summary> /// <param name="request">Request of GetFolder operation.</param> /// <returns>Response of GetFolder operation.</returns> public GetFolderResponseType GetFolder(GetFolderType request) { // Send the request and get the response. GetFolderResponseType response = this.exchangeServiceBinding.GetFolder(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.VerifyGetFolderResponse(response, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyAllRelatedRequirements(this.exchangeServiceBinding.IsSchemaValidated, response); } // Verify transport type related requirement. this.VerifyTransportType(); // Verify soap version. this.VerifySoapVersion(); return(response); }
public BaseFolderType GetFolder(DistinguishedFolderIdNameType folderType) { var binding = ChannelHelper.BuildChannel(hostname, username, password); var getFolderType = new GetFolderType { FolderIds = new[] { new DistinguishedFolderIdType { Id = folderType } }, FolderShape = new FolderResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties } }; var getFolderResponse = binding.GetFolder(getFolderType); if (getFolderResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error) { throw new Exception(getFolderResponse.ResponseMessages.Items[0].MessageText); } return(((FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0]).Folders[0]); }
// Token: 0x0600057B RID: 1403 RVA: 0x00029D74 File Offset: 0x00027F74 public BaseFolderType GetFolderById(BaseFolderIdType folderId, BasePathToElementType[] additionalProperties) { GetFolderType getFolder = new GetFolderType(); FolderResponseShapeType folderResponseShapeType = new FolderResponseShapeType(); folderResponseShapeType.BaseShape = DefaultShapeNamesType.IdOnly; folderResponseShapeType.AdditionalProperties = additionalProperties; getFolder.FolderShape = folderResponseShapeType; getFolder.FolderIds = new BaseFolderIdType[] { folderId }; List <BaseFolderType> folders = new List <BaseFolderType>(1); this.CallService(() => this.ServiceBinding.GetFolder(getFolder), delegate(ResponseMessageType responseMessage, int messageIndex) { if (responseMessage.ResponseClass == ResponseClassType.Error) { if (responseMessage.ResponseCode != ResponseCodeType.ErrorItemNotFound) { folders.Clear(); throw new RetryException(new ElcEwsException(ElcEwsErrorType.FailedToGetFolderById, responseMessage.ResponseCode.ToString() + " : " + responseMessage.MessageText), false); } } else { FolderInfoResponseMessageType folderInfoResponseMessageType = (FolderInfoResponseMessageType)responseMessage; folders.Add(folderInfoResponseMessageType.Folders[0]); } return(true); }, (Exception exception) => ElcEwsClient.WrapElcEwsException(ElcEwsErrorType.FailedToGetFolderById, exception)); if (folders.Count <= 0) { return(null); } return(folders[0]); }
public BaseFolderType GetFolder(string remoteFolderId) { GetFolderType request = new GetFolderType { FolderShape = ExchangeService.GetFolderShape, FolderIds = new BaseFolderIdType[] { new FolderIdType { Id = remoteFolderId } } }; FolderInfoResponseMessageType folder = this.GetFolder(request); if (folder.Folders == null || folder.Folders.Length != 1) { ExchangeService.Tracer.TraceError<ExchangeService, string>((long)this.GetHashCode(), "{0}: received unexpected response for folder : {1}", this, remoteFolderId); throw new UnexpectedRemoteDataException(new ResponseMessageType[] { folder }); } return folder.Folders[0]; }
protected override IAsyncResult BeginInvoke() { GetFolderType getFolder = new GetFolderType { FolderShape = GetFolderRequest.GetFolderShape, FolderIds = new BaseFolderIdType[] { new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.calendar } } }; this.binding.Authenticator = SoapHttpClientAuthenticator.CreateNetworkService(); this.binding.Authenticator.AdditionalSoapHeaders.Add(new SerializedSecurityContextType { UserSid = (this.query.RecipientData.Sid ?? this.query.RecipientData.MasterAccountSid).ToString(), GroupSids = GetFolderRequest.SidStringAndAttributesConverter(ClientSecurityContext.DisabledEveryoneOnlySidStringAndAttributesArray), RestrictedGroupSids = null, PrimarySmtpAddress = this.query.RecipientData.PrimarySmtpAddress.ToString() }); return(this.binding.BeginGetFolder(getFolder, new AsyncCallback(base.Complete), null)); }
public void MSOXWSFOLD_S04_TC08_GetExtendedProperty() { #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); // Set folder class to null. createFolderRequest.Folders[0].FolderClass = null; // Set folder extended property and its value. PathToExtendedFieldType publishInAddressBook = new PathToExtendedFieldType(); // Set extended property Id and type. publishInAddressBook.PropertyTag = "0x671E"; publishInAddressBook.PropertyType = MapiPropertyTypeType.Boolean; ExtendedPropertyType pubAddressbook = new ExtendedPropertyType(); pubAddressbook.ExtendedFieldURI = publishInAddressBook; // Set extended property value. pubAddressbook.Item = "1"; ExtendedPropertyType[] extendedProperties = new ExtendedPropertyType[1]; extendedProperties[0] = pubAddressbook; createFolderRequest.Folders[0].ExtendedProperty = extendedProperties; // 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 // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R7801"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R7801 // Folder created successfully with extended property this requirement can be captured. this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, createFolderResponse.ResponseMessages.Items[0].ResponseCode, 7801, @"[In t:BaseFolderType Complex Type]This element [ExtendedProperty] is present, server responses NO_ERROR."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R980302"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R980302 // Folder created successfully without permission set so this requirement can be covered. this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, createFolderResponse.ResponseMessages.Items[0].ResponseCode, 980302, @"[In t:FolderType Complex Type]This element [PermissionSet] is not present, server responses NO_ERROR."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R589202"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R589202 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, createFolderResponse.ResponseMessages.Items[0].ResponseCode, 589202, @"[In t:BaseFolderType Complex Type]This element [FolderClass] is not present, server responses NO_ERROR."); #region Get the new created folder // GetFolder request. GetFolderType getNewFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, newFolderId); getNewFolderRequest.FolderShape.AdditionalProperties = new BasePathToElementType[1]; getNewFolderRequest.FolderShape.AdditionalProperties[0] = publishInAddressBook; // Get the new created folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getNewFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 1, this.Site); FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0]; FolderType folderInfo = (FolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R423"); // Folder ids is set in request and response is returned from server so this requirement can be captured. this.Site.CaptureRequirement( 423, @"[In m:GetFolderType Complex Type]FolderIds is an array of one or more folder identifiers."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R426"); // Folder id that contains id and change key value is set in request and response is returned from server so this requirement can be captured. this.Site.CaptureRequirement( 426, @"[In t:NonEmptyArrayOfBaseFolderIdsType Complex Type]FolderId specifies the folder identifier and change key. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R77"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R77 // Extended property value is returned from server, and schema is verified in adapter so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.ExtendedProperty, 77, @"[In t:BaseFolderType Complex Type]The type of element ExtendedProperty is t:ExtendedPropertyType ([MS-OXWSXPROP] section 2.1.5)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R7701"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R7701 // In create operation this property value is set to 1 and type to Boolean this means the value is "true" in string type. this.Site.CaptureRequirementIfAreEqual <string>( "true", ((ExtendedPropertyType)folderInfo.ExtendedProperty.GetValue(0)).Item.ToString(), 7701, @"[In t:BaseFolderType Complex Type]ExtendedProperty specifies the set of extended properties on a folder."); }
public void MSOXWSFOLD_S04_TC07_UnReadCount() { #region Get the Inbox folder DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.inbox; // GetFolder request. GetFolderType getInboxRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Inbox folder. GetFolderResponseType getInboxResponse = this.FOLDAdapter.GetFolder(getInboxRequest); // Check the response. Common.CheckOperationSuccess(getInboxResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getInboxResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; // Variable to save the count of unread messages before sent mail to the specific account. // Save the unread message count. int count = ((FolderType)folderInfo).UnreadCount; #endregion #region Create an unread message. string itemName = Common.GenerateResourceName(this.Site, "Test Mail"); // Send a mail to User1 ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), DistinguishedFolderIdNameType.inbox.ToString(), itemName); this.NewCreatedItemIds.Add(itemId); #endregion #region Get the Inbox folder // Set the request's folderId field. folder.Id = DistinguishedFolderIdNameType.inbox; // GetFolder request. GetFolderType getInboxAfterMailReceivedRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Inbox folder. GetFolderResponseType getInboxAfterMailReceivedResponse = this.FOLDAdapter.GetFolder(getInboxAfterMailReceivedRequest); // Check the response. Common.CheckOperationSuccess(getInboxAfterMailReceivedResponse, 1, this.Site); // Variable to save the folder. allFolders = (FolderInfoResponseMessageType)getInboxAfterMailReceivedResponse.ResponseMessages.Items[0]; folderInfo = (BaseFolderType)allFolders.Folders[0]; FolderType folderType = (FolderType)folderInfo; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R99"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R99 // Unread count value is returned from server, and schema is verified in adapter so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderType.UnreadCount, 99, @"[In t:FolderType Complex Type]The type of element UnreadCount is xs:int [XMLSCHEMA2]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R10010"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R10010 // After sending a new message to mail box, the number of unread messages should be (count + 1). this.Site.CaptureRequirementIfAreEqual <int>( 1 + count, folderType.UnreadCount, 10010, @"[In t:FolderType Complex Type]This element[UnreadCount] MUST exist in responses."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9901"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9901 this.Site.CaptureRequirementIfAreEqual <int>( 1 + count, folderType.UnreadCount, 9901, @"[In t:FolderType Complex Type]UnreadCount specifies the number of unread items in a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R10011"); // Since R9901 and R100 are captured successfully, this requirement will be captured. this.Site.CaptureRequirement( 10011, @"[In t:FolderType Complex Type]This element[UnreadCount] MUST equal the sum of all MessageType complex types ([MS-OXWSMSG] section 2.2.4.3) and PostItemType complex types ([MS-OXWSPOST] section 2.2.4.1) that have the IsRead property set to ""false""."); }
public void CheckAndCreateWellKnownFolder(DistinguishedFolderIdNameType parentFolder, DistinguishedFolderIdNameType targetFolder, out FolderIdType targetFolderId) { targetFolderId = null; GetFolderType getFolder = new GetFolderType { FolderShape = new FolderResponseShapeType { BaseShape = DefaultShapeNamesType.Default }, FolderIds = new BaseFolderIdType[] { new DistinguishedFolderIdType { Id = targetFolder } } }; FolderIdType localTargetFolderId = null; bool retry = false; do { this.CallEwsWithRetries((LID)47292U, () => this.binding.GetFolder(getFolder), delegate(ResponseMessageType responseMessage, int messageIndex) { FolderInfoResponseMessageType folderInfoResponseMessageType = responseMessage as FolderInfoResponseMessageType; if (folderInfoResponseMessageType != null && folderInfoResponseMessageType.ResponseClass == ResponseClassType.Success && folderInfoResponseMessageType.Folders != null && folderInfoResponseMessageType.Folders.Length == 1) { localTargetFolderId = folderInfoResponseMessageType.Folders[0].FolderId; if (this.IsTraceEnabled(TraceType.DebugTrace)) { this.Tracer.TraceDebug <string, string>(0L, "Found the folder {0} with the id {1}", targetFolder.ToString(), localTargetFolderId.Id); } retry = false; return(true); } return(false); }, delegate(ResponseMessageType responseMessage, int messageIndex) { if (responseMessage != null && responseMessage.ResponseClass == ResponseClassType.Error && responseMessage.ResponseCode == ResponseCodeType.ErrorFolderNotFound && !retry) { DiagnosticContext.TraceLocation((LID)37196U); if (this.IsTraceEnabled(TraceType.DebugTrace)) { this.Tracer.TraceDebug(0L, "Folder not found, an attempt will be made to create it", new object[] { targetFolder.ToString(), responseMessage.ResponseClass, responseMessage.ResponseCode, responseMessage.MessageText }); } return(true); } return(false); }); if (localTargetFolderId == null && !retry) { DiagnosticContext.TraceLocation((LID)61628U); if (!this.InternalCreateFolder(new CreateFolderType { ParentFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = parentFolder, Mailbox = this.Mailbox } }, Folders = new BaseFolderType[] { new FolderType { DistinguishedFolderId = targetFolder, DistinguishedFolderIdSpecified = true } } }, delegate(ResponseMessageType responseMessage, int messageIndex) { if (responseMessage != null && responseMessage.ResponseClass == ResponseClassType.Error && responseMessage.ResponseCode == ResponseCodeType.ErrorInvalidOperation) { DiagnosticContext.TraceLocation((LID)53580U); retry = true; return(true); } return(false); }, out localTargetFolderId)) { localTargetFolderId = null; } } }while (retry); ExAssert.RetailAssert(localTargetFolderId != null, "Well known folder ID must be valid at this point"); targetFolderId = localTargetFolderId; }
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. "); }
public void MSOXWSFOLD_S04_TC01_GetCalendarFolder() { #region Get the Calendar folder. DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = (DistinguishedFolderIdNameType)DistinguishedFolderIdNameType.calendar; // GetFolder request. GetFolderType getCalendarFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.IdOnly, folder); // Set to get additional property : folder class getCalendarFolderRequest.FolderShape.AdditionalProperties = new BasePathToElementType[] { new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.folderFolderClass }, new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.folderEffectiveRights } }; // Get the Calendar folder. GetFolderResponseType getCalendarFolderResponse = this.FOLDAdapter.GetFolder(getCalendarFolderRequest); // Check the response. Common.CheckOperationSuccess(getCalendarFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType foldersResponseInfo = (FolderInfoResponseMessageType)getCalendarFolderResponse.ResponseMessages.Items[0]; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R29"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R29 this.Site.CaptureRequirementIfIsInstanceOfType( foldersResponseInfo.Folders[0], typeof(CalendarFolderType), 29, @"[In t:ArrayOfFoldersType Complex Type]The type of element CalendarFolder is t:CalendarFolderType ([MS-OXWSMTGS] section 2.2.4.5)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R2901"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R2901 this.Site.CaptureRequirementIfIsInstanceOfType( foldersResponseInfo.Folders[0], typeof(CalendarFolderType), 2901, @"[In t:ArrayOfFoldersType Complex Type]CalendarFolder represents a Calendar folder in a mailbox."); CalendarFolderType folderInfo = (CalendarFolderType)foldersResponseInfo.Folders[0]; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R81"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R81 // Since the schema has been validate and this element is not null, this requirement will be captured. this.Site.CaptureRequirementIfIsNotNull( folderInfo.EffectiveRights, 81, @"[In t:BaseFolderType Complex Type]The type of element EffectiveRights is t:EffectiveRightsType ([MS-OXWSCDATA] section 2.2.4.29)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5934"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5934 // Effective rights is returned in response and schema is verified in adapter so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( folderInfo.EffectiveRights, 5934, @"[In t:BaseFolderType Complex Type]This property[EffectiveRights] is returned in a response."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R70."); // Verify MS-OXWSFOLD_R70. Site.CaptureRequirementIfAreEqual <string>( "IPF.Appointment", folderInfo.FolderClass, 70, @"[In t:BaseFolderType Complex Type]This value[FolderClass] MUST be ""IPF.Appointment"" for Calendar folders."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R42104"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R42104 // Additional property folder class is returned from server and schema is verified in adapter, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( folderInfo.FolderClass, 42104, @"[In t:FolderResponseShapeType Complex Type]The element [AdditionalProperties] with type [t:NonEmptyArrayOfPathsToElementType] specifies the identity of additional properties to be returned in a response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R42105"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R42105 // Additional property folder class is returned from server and schema is verified in adapter, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( folderInfo.FolderClass, 42105, @"[In t:FolderResponseShapeType Complex Type][In t:NonEmptyArrayOfPathsToElementType Complex Type] The element [t:Path] with type [t:Path] specifies a property to be returned in a response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3864"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3864 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, getCalendarFolderResponse.ResponseMessages.Items[0].ResponseClass, 3864, @"[In GetFolder Operation]A successful GetFolder operation request returns a GetFolderResponse element with the ResponseClass attribute of the GetFolderResponseMessage element set to ""Success""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R38644"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R38644 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, getCalendarFolderResponse.ResponseMessages.Items[0].ResponseCode, 38644, @"[In GetFolder Operation]A successful GetFolder operation request returns a GetFolderResponse element with the ResponseCode element of the GetFolderResponse element set to ""NoError""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R575"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R575 // Folder information is returned from server and schema has verified in adapter, so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( foldersResponseInfo, 575, @"[In m:GetFolderType Complex Type]The GetFolderType complex type specifies a request message to get a folder in a server database."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R428"); // GetFolder operation in this test case gets a distinguished folder : Calendar folder. this.Site.CaptureRequirement( 428, @"[In t:NonEmptyArrayOfBaseFolderIdsType Complex Type]DistinguishedFolderId specifies a distinguished folder identifier."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8402"); // GetFolder operation in this test case gets a distinguished folder : Calendar folder. this.Site.CaptureRequirement( 8402, @"[In t:BaseFolderType Complex Type]DistinguishedFolderId specifies an identifier for a folder that can be referenced by name."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R96"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R96 // Folder information is returned from server and schema has verified in adapter, so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( foldersResponseInfo, 96, @"[In m:FolderInfoResponseMessageType Complex Type]The type of element Folders is t:ArrayOfFoldersType (section 2.2.4.2)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9602"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9602 // Folder information is returned from server and schema has verified in adapter, so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( foldersResponseInfo, 9602, @"[In m:FolderInfoResponseMessageType Complex Type][Folders] Represents the folders that are returned with the response message."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8401"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R8401 // Distinguished folder id is set in request and schema is verified in adapter, so if folder information is returned successfully this can be covered. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, getCalendarFolderResponse.ResponseMessages.Items[0].ResponseClass, 8401, @"[In t:BaseFolderType Complex Type]The type of element DistinguishedFolderId is t:DistinguishedFolderIdNameType ([MS-OXWSCDATA] section 2.2.5.10)."); #endregion }
public void MSOXWSFOLD_S04_TC02_GetContactsFolder() { #region Get the contacts folder. DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.contacts; // GetFolder request. GetFolderType getContactsFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Contacts folder. GetFolderResponseType getContactsFolderResponse = this.FOLDAdapter.GetFolder(getContactsFolderRequest); // Check the response. Common.CheckOperationSuccess(getContactsFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getContactsFolderResponse.ResponseMessages.Items[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R31"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R31 this.Site.CaptureRequirementIfIsInstanceOfType( allFolders.Folders[0], typeof(ContactsFolderType), 31, @"[In t:ArrayOfFoldersType Complex Type]The type of element ContactsFolder is t:ContactsFolderType ([MS-OXWSCONT] section 3.1.4.1.1.6)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3301"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3301 this.Site.CaptureRequirementIfIsInstanceOfType( allFolders.Folders[0], typeof(ContactsFolderType), 3301, @"[In t:ArrayOfFoldersType Complex Type]ContactsFolder represents a Contacts folder in a mailbox."); ContactsFolderType folderInfo = (ContactsFolderType)allFolders.Folders[0]; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R69"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R69 // Folder class value is returned from server and schema has verified in adapter, so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.FolderClass, 69, @"[In t:BaseFolderType Complex Type]The type of element FolderClass is xs:string [XMLSCHEMA2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R585."); // Verify MS-OXWSFOLD_R585. Site.CaptureRequirementIfAreEqual <string>( "IPF.Contact", folderInfo.FolderClass, 585, @"[In t:BaseFolderType Complex Type]This value[FolderClass] MUST be ""IPF.Contact"" for Contacts folders."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R7101"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R7101 this.Site.CaptureRequirementIfAreEqual <string>( "Contacts", folderInfo.DisplayName, 7101, @"[In t:BaseFolderType Complex Type]DisplayName specifies the display name of the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R71"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R71 // Folder display name is returned from server and schema has verified in adapter, so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.DisplayName, 71, @"[In t:BaseFolderType Complex Type]The type of element DisplayName is xs:string."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R66"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R66 // Folder id is returned from server and schema has verified in adapter, so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.FolderId, 66, @"[In t:BaseFolderType Complex Type]The type of element FolderId is t:FolderIdType ([MS-OXWSCDATA] section 2.2.4.36)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6602"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6602 // Folder id is returned from server and schema is verified in adapter so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.FolderId, 6602, @"[In t:BaseFolderType Complex Type]FolderId specifies the folder identifier and change key."); }
public void MSOXWSFOLD_S03_TC01_FolderPropertiesAfterMoved() { #region Create two nested folders with an item in the high-level one into the "drafts" folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.drafts.ToString(), new string[] { "ForMoveFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Create a message into this folder string itemName = Common.GenerateResourceName(this.Site, "Test Mail"); ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), newFolderId.Id, itemName); this.NewCreatedItemIds.Add(itemId); // Create sub folder request. CreateFolderType createSubFolderRequest = this.GetCreateFolderRequest(newFolderId.Id, new string[] { "SubFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createNewFolderResponse = this.FOLDAdapter.CreateFolder(createSubFolderRequest); // Check the response. Common.CheckOperationSuccess(createNewFolderResponse, 1, this.Site); FolderIdType subFolderId = ((FolderInfoResponseMessageType)createNewFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(subFolderId); #endregion #region Move the new created folder to the inbox folder // MoveFolder request. MoveFolderType moveFolderRequest = new MoveFolderType(); // Set the request's folderId field. moveFolderRequest.FolderIds = new BaseFolderIdType[1]; moveFolderRequest.FolderIds[0] = newFolderId; // Set the request's destFolderId field. DistinguishedFolderIdType toFolderId = new DistinguishedFolderIdType(); toFolderId.Id = DistinguishedFolderIdNameType.inbox; moveFolderRequest.ToFolderId = new TargetFolderIdType(); moveFolderRequest.ToFolderId.Item = toFolderId; // Move the specified folder. MoveFolderResponseType moveFolderResponse = this.FOLDAdapter.MoveFolder(moveFolderRequest); // Check the response. Common.CheckOperationSuccess(moveFolderResponse, 1, this.Site); FolderIdType movedFolderId = ((FolderInfoResponseMessageType)moveFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(movedFolderId); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4314"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4314 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, moveFolderResponse.ResponseMessages.Items[0].ResponseCode, 4314, @"[In MoveFolder Operation]A successful MoveFolder operation request returns a MoveFolderResponse element with the ResponseCode element of the MoveFolderResponse element set to ""NoError""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R43144"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R43144 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, moveFolderResponse.ResponseMessages.Items[0].ResponseClass, 43144, @"[In MoveFolder Operation]A successful MoveFolder operation request returns a MoveFolderResponse element with the ResponseClass attribute of the MoveFolderResponseMessage element set to ""Success""."); #region Get the inbox folder's folder id DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.inbox; // GetFolder request. GetFolderType getInboxFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Inbox folder. GetFolderResponseType getInboxFolderResponse = this.FOLDAdapter.GetFolder(getInboxFolderRequest); // Check the response. Common.CheckOperationSuccess(getInboxFolderResponse, 1, this.Site); // Variable to save folder. FolderInfoResponseMessageType inboxFolder = (FolderInfoResponseMessageType)getInboxFolderResponse.ResponseMessages.Items[0]; BaseFolderType inboxFolderInfo = (BaseFolderType)inboxFolder.Folders[0]; // Save the inbox's folder id. FolderIdType inboxFolderId = inboxFolderInfo.FolderId; #endregion #region Get the new created folder after moved to inbox folder // GetFolder request. GetFolderType getSubFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, movedFolderId); // Get the specified folder. GetFolderResponseType getSubFolderResponse = this.FOLDAdapter.GetFolder(getSubFolderRequest); // Check the response. Common.CheckOperationSuccess(getSubFolderResponse, 1, this.Site); FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getSubFolderResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R595"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R595 // Since one message in the folder before move, if TotalCount for the folder is 1 after move, this requirement can be captured. this.Site.CaptureRequirementIfAreEqual <int>( 1, folderInfo.TotalCount, 595, @"[In MoveFolder Operation]The contents of the folder move with the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R461"); // The moved folder can be gotten successfully, so the specified folder was moved. this.Site.CaptureRequirement( 461, @"[In m:MoveFolderType Complex Type]The MoveFolderType complex type specifies a request message to move folders in a mailbox."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R429"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R429 this.Site.CaptureRequirementIfAreEqual <string>( inboxFolderId.Id, folderInfo.ParentFolderId.Id, 429, @"[In MoveFolder Operation]The MoveFolder operation moves folders from a specified parent folder and puts them in another parent folder."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R594"); // Verify MS-OXWSFOLD_R594. // Verify if the values of FolderClass and DisplayName property are changed after the folder being moved. bool isVerifyR594 = folderInfo.FolderClass == "IPF.MyCustomFolderClass" && folderInfo.DisplayName == createFolderRequest.Folders[0].DisplayName; Site.Log.Add( LogEntryKind.Debug, "FolderClass expected to be \"IPF.MyCustomFolderClass\" and actual is {0};\n" + "DisplayName expected to be {1} and actual is {2};\n ", folderInfo.FolderClass, createFolderRequest.Folders[0].DisplayName, folderInfo.DisplayName); Site.CaptureRequirementIfIsTrue( isVerifyR594, 594, @"[In MoveFolder Operation]The properties FolderClass and DisplayName of the folder move with the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R7501"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R7501 // Only one child folder was created in the folder. this.Site.CaptureRequirementIfAreEqual <int>( 1, folderInfo.ChildFolderCount, 7501, @"[In t:BaseFolderType Complex Type]ChildFolderCount specifies the total number of child folders in a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5912"); // Child folder count is returned from server so this requirement can be captured. this.Site.CaptureRequirement( 5912, @"[In t:BaseFolderType Complex Type]This property[ChildFolderCount] is returned in a response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R75"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R75 this.Site.CaptureRequirementIfIsNotNull( folderInfo.ChildFolderCount, 75, @"[In t:BaseFolderType Complex Type]The type of element ChildFolderCount is xs:int."); #region Get subfolder in the moved folder // GetFolder request. GetFolderType getSubFolderAfterMovedRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, subFolderId); // Get the specified folder. GetFolderResponseType getFolderAfterMovedResponse = this.FOLDAdapter.GetFolder(getSubFolderAfterMovedRequest); // Check the response. Common.CheckOperationSuccess(getFolderAfterMovedResponse, 1, this.Site); allFolders = (FolderInfoResponseMessageType)getFolderAfterMovedResponse.ResponseMessages.Items[0]; folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R596"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R596 this.Site.CaptureRequirementIfAreEqual <string>( movedFolderId.ToString(), folderInfo.ParentFolderId.ToString(), 596, @"[In MoveFolder Operation]The subfolders of the folder move with the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R68"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R68 // Parent folder id is returned from server, and schema is verified in adapter so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.ParentFolderId, 68, @"[In t:BaseFolderType Complex Type]The type of element ParentFolderId is t:FolderIdType."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6801"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6801 this.Site.CaptureRequirementIfAreEqual <string>( NewCreatedFolderIds[0].ToString(), folderInfo.ParentFolderId.ToString(), 6801, @"[In t:BaseFolderType Complex Type]ParentFolderId specifies the folder identifier and change key for the parent folder."); }
public void MSOXWSFOLD_S05_TC05_SoftEmptyFolder() { Site.Assume.IsTrue(Common.IsRequirementEnabled(5664, this.Site), "Exchange Server 2007 and the initial release version of Exchange Server 2010 do not support EmptyFolder operation"); Site.Assume.IsTrue(Common.IsRequirementEnabled(4000, this.Site), "Exchange Server 2007 and the initial release version of Exchange Server 2010 do not include enumeration value recoverableitemsdeletions"); #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 Create an item string itemName = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in the new created folder. ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), newFolderId.Id, itemName); Site.Assert.IsNotNull(itemId, "Item should be created successfully!"); #endregion #region Get the new created folder // GetFolder request. GetFolderType getNewFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, newFolderId); // Get the new created folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getNewFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 1, this.Site); #endregion #region Empty the created folder EmptyFolderResponseType emptyFolderResponse = this.CallEmptyFolderOperation(newFolderId, DisposalType.SoftDelete, true); Common.CheckOperationSuccess(emptyFolderResponse, 1, this.Site); #endregion #region Find the item ItemIdType findItemID = this.FindItem(DistinguishedFolderIdNameType.recoverableitemsdeletions.ToString(), itemName); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R37803"); this.Site.CaptureRequirementIfIsNotNull( findItemID, 37803, @"[In m:EmptyFolderType Complex Type ]DeleteType which value is SoftDelete specifies that an item or folder is moved to the dumpster if the dumpster is enabled."); DeleteItemType deleteItemRequest = new DeleteItemType(); deleteItemRequest.ItemIds = new BaseItemIdType[] { findItemID }; DeleteItemResponseType deleteItemResponse = this.COREAdapter.DeleteItem(deleteItemRequest); Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); #endregion }
private FolderInfoResponseMessageType GetFolder(GetFolderType request) { return this.ExecuteWebMethodSingleResponse<FolderInfoResponseMessageType>(() => this.binding.GetFolder(request)); }
/// <remarks/> public void GetFolderAsync(GetFolderType GetFolder1) { this.GetFolderAsync(GetFolder1, null); }
public void MSOXWSFOLD_S02_TC01_CopyFolder() { #region Copy the "drafts" folder to the inbox folder // Identify the folders to be copied. DistinguishedFolderIdType copiedFolderId = new DistinguishedFolderIdType(); copiedFolderId.Id = DistinguishedFolderIdNameType.drafts; // CopyFolder request. CopyFolderType copyFolderRequest = this.GetCopyFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), copiedFolderId); // Copy the "drafts" folder. CopyFolderResponseType copyFolderResponse = this.FOLDAdapter.CopyFolder(copyFolderRequest); // Check the response. Common.CheckOperationSuccess(copyFolderResponse, 1, this.Site); // Variable to save the folder. FolderIdType folderId = ((FolderInfoResponseMessageType)copyFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the copied folder's folder id. this.NewCreatedFolderIds.Add(folderId); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R1852"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R1852 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, copyFolderResponse.ResponseMessages.Items[0].ResponseClass, 1852, @"[In CopyFolder Operation]A successful CopyFolder operation request returns a CopyFolderResponse element with the ResponseClass attribute of the CopyFolderResponseMessage element set to ""Success""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R185222"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R185222 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, copyFolderResponse.ResponseMessages.Items[0].ResponseCode, 185222, @"[In CopyFolder Operation]A successful CopyFolder operation request returns a CopyFolderResponse element with the ResponseCode element of the CopyFolderResponse element set to ""NoError""."); #region Get the new copied folder // GetFolder request. GetFolderType getSubFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId); // Get the specified folder. GetFolderResponseType getSubFolderResponse = this.FOLDAdapter.GetFolder(getSubFolderRequest); // Check the response. Common.CheckOperationSuccess(getSubFolderResponse, 1, this.Site); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R211"); // The copied folder can be gotten successfully through returned folder id, so the draft folder was copied. this.Site.CaptureRequirement( 211, @"[In m:CopyFolderType Complex Type]The CopyFolderType complex type specifies a request message to copy folders in a server database."); }
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_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_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_S02_TC03_CopyPublicFolder() { Site.Assume.IsTrue(Common.IsRequirementEnabled(55501, this.Site), "Exchange 2007 and Exchange 2010 support the CopyFolder operation if either the source folder or the destination folder is a public folder"); #region Create a new public folder in the public folder root // CreateFolder request. CreateFolderType createPublicFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.publicfoldersroot.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new public folder. CreateFolderResponseType createPublicFolderResponse = this.FOLDAdapter.CreateFolder(createPublicFolderRequest); // Check the response. Common.CheckOperationSuccess(createPublicFolderResponse, 1, this.Site); // Save the new created public folder's folder id. FolderIdType newPublicFolderId = ((FolderInfoResponseMessageType)createPublicFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newPublicFolderId); #endregion #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 Copy the public folder to the folder created in inbox // CopyFolder request. CopyFolderType copyPublicFolderRequest = this.GetCopyFolderRequest(newFolderId.Id, newPublicFolderId); // Copy the public folder. CopyFolderResponseType copyPublicFolderResponse = this.FOLDAdapter.CopyFolder(copyPublicFolderRequest); // Check the response. Common.CheckOperationSuccess(copyPublicFolderResponse, 1, this.Site); // Variable to save the folder. FolderIdType copiedPublicFolderId = ((FolderInfoResponseMessageType)copyPublicFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the copied folder's folder id. this.NewCreatedFolderIds.Add(copiedPublicFolderId); #endregion #region Get the new copied public folder that in inbox // GetFolder request. GetFolderType getNewCopiedPulicFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, copiedPublicFolderId); // Get the new copied public folder. GetFolderResponseType getNewCopiedPublicFolderResponse = this.FOLDAdapter.GetFolder(getNewCopiedPulicFolderRequest); // Check the response. Common.CheckOperationSuccess(getNewCopiedPublicFolderResponse, 1, this.Site); #endregion #region Copy the folder in inbox to the public folder created // CopyFolder request. CopyFolderType copyFolderRequest = this.GetCopyFolderRequest(newPublicFolderId.Id, newFolderId); // Copy the public folder. CopyFolderResponseType copyFolderResponse = this.FOLDAdapter.CopyFolder(copyFolderRequest); // Check the response. Common.CheckOperationSuccess(copyFolderResponse, 1, this.Site); // Variable to save the folder. FolderIdType copiedFolderId = ((FolderInfoResponseMessageType)copyFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the copied folder's folder id. this.NewCreatedFolderIds.Add(copiedFolderId); #endregion #region Get the new copied folder that in root public folder // GetFolder request. GetFolderType getNewCopiedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, copiedFolderId); // Get the new copied folder. GetFolderResponseType getNewCopiedFolderResponse = this.FOLDAdapter.GetFolder(getNewCopiedFolderRequest); // Check the response. Common.CheckOperationSuccess(getNewCopiedFolderResponse, 1, this.Site); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R55501"); // Folder can be copied successfully either when the source folder or destination folder is public folder ,so this requirement can be captured. this.Site.CaptureRequirement( 55501, @"[In Appendix C: Product Behavior] Implementation does support the CopyFolder operation if either the source folder or the destination folder is a public folder.(Exchange Server 2007 and Exchange Server 2010 follow this behavior.)"); }
public void MSOXWSFOLD_S05_TC02_EmptyFolderWithoutDeletingSubFolder() { Site.Assume.IsTrue(Common.IsRequirementEnabled(5664, this.Site), "Exchange Server 2007 and the initial release version of Exchange Server 2010 do not support EmptyFolder operation"); #region Create a new item and a new folder with an item in the Inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "ToBeDeleteFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(newFolderId); string itemName1 = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in the new created folder. ItemIdType itemInFolder = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), newFolderId.Id, itemName1); Site.Assert.IsNotNull(itemInFolder, "Item should be created successfully!"); string itemName2 = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in inbox. ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), DistinguishedFolderIdNameType.inbox.ToString(), itemName2); Site.Assert.IsNotNull(itemId, "Item should be created successfully!"); // Variable to indicate whether the item2 is created properly. bool isItem2Created = this.FindItem(DistinguishedFolderIdNameType.inbox.ToString(), itemName2) != null; Site.Assert.IsTrue(isItem2Created, "The item should be created successfully in the specific folder."); #endregion #region Empty the inbox folder. DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.inbox; // Empty the specific folder EmptyFolderResponseType emptyFolderResponse = this.CallEmptyFolderOperation(folderId, DisposalType.HardDelete, false); // Check the response. Common.CheckOperationSuccess(emptyFolderResponse, 1, this.Site); #endregion #region Get the folder in inbox folder to verify whether it has been deleted // GetFolder request. GetFolderType getFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, newFolderId); // Get the specific folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 1, this.Site); #endregion // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R381"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R381. Site.CaptureRequirementIfAreNotEqual <ResponseCodeType>( ResponseCodeType.ErrorItemNotFound, getFolderResponse.ResponseMessages.Items[0].ResponseCode, 381, @"[In m:EmptyFolderType Complex Type][if the subfolders are not to be deleted], it is set to ""false"". "); }
/// <remarks/> public System.IAsyncResult BeginGetFolder(GetFolderType GetFolder1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetFolder", new object[] { GetFolder1}, callback, asyncState); }
public void MSOXWSFOLD_S05_TC03_EmptyFolderMoveToDeletedItems() { Site.Assume.IsTrue(Common.IsRequirementEnabled(5664, this.Site), "Exchange Server 2007 and the initial release version of Exchange Server 2010 do not support EmptyFolder operation"); #region Create a new item and a new folder with an item in the Inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "ToBeDeleteFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newFolderId); string itemName1 = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in the new created folder. ItemIdType itemInFolder = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), newFolderId.Id, itemName1); Site.Assert.IsNotNull(itemInFolder, "Item should be created successfully!"); string itemName2 = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in inbox. ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), DistinguishedFolderIdNameType.inbox.ToString(), itemName2); Site.Assert.IsNotNull(itemId, "Item should be created successfully!"); // Variable to indicate whether the item2 is created properly. bool isItem2Created = this.FindItem(DistinguishedFolderIdNameType.inbox.ToString(), itemName2) != null; Site.Assert.IsTrue(isItem2Created, "The item should be created successfully in the specific folder."); #endregion #region Empty the inbox folder // Specify which folder will be emptied. DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.inbox; // Empty the specific folder EmptyFolderResponseType emptyFolderResponse = this.CallEmptyFolderOperation(folderId, DisposalType.MoveToDeletedItems, true); // Check the response. Common.CheckOperationSuccess(emptyFolderResponse, 1, this.Site); #endregion #region Get the folder in inbox folder to verify whether it has been deleted // GetFolder request. GetFolderType getFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, newFolderId); // Get the specific folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 1, this.Site); #endregion #region Find the item to see whether it has been deleted // Verify if item under inbox exists. ItemIdType itemIdAfterEmpty = this.FindItem(DistinguishedFolderIdNameType.deleteditems.ToString(), itemName2); bool isItemInDeletedItems = itemIdAfterEmpty != null; this.NewCreatedItemIds.Add(itemIdAfterEmpty); #endregion #region Get new created folder's parent folder GetFolderType getParentFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, ((FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0]).Folders[0].ParentFolderId); // Get the new created folder. GetFolderResponseType getParentFolderResponse = this.FOLDAdapter.GetFolder(getParentFolderRequest); // Check the response. Common.CheckOperationSuccess(getParentFolderResponse, 1, this.Site); string folderDisplayName = ((FolderInfoResponseMessageType)getParentFolderResponse.ResponseMessages.Items[0]).Folders[0].DisplayName; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R37802"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R37802 bool isVerifiedR37802 = folderDisplayName.Equals("Deleted Items") && isItemInDeletedItems; Site.Assert.IsTrue( isVerifiedR37802, "Parent folder name after deleted expected to be \"Deleted Items\" and actual is {0};\n" + "Item in deleted items expected to be \"true\" and actual is {1};\n ", folderDisplayName, isItemInDeletedItems); this.Site.CaptureRequirementIfIsTrue( isVerifiedR37802, 37802, @"[In m:EmptyFolderType Complex Type ]DeleteType which value is MoveToDeletedItems specifies that an item or folder is moved to the Deleted Items folder."); }
/// <remarks/> public void GetFolderAsync(GetFolderType GetFolder1, object userState) { if ((this.GetFolderOperationCompleted == null)) { this.GetFolderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFolderOperationCompleted); } this.InvokeAsync("GetFolder", new object[] { GetFolder1}, this.GetFolderOperationCompleted, userState); }
public void MSOXWSFOLD_S05_TC01_EmptyFolder() { Site.Assume.IsTrue(Common.IsRequirementEnabled(5664, this.Site), "Exchange Server 2007 and the initial release version of Exchange Server 2010 do not support EmptyFolder operation"); #region Create a new item and a new folder with an item in the Inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "ToBeDeleteFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; string itemName1 = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in the new created folder. ItemIdType itemInFolder = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), newFolderId.Id, itemName1); Site.Assert.IsNotNull(itemInFolder, "Item should be created successfully!"); string itemName2 = Common.GenerateResourceName(this.Site, "Test Mail"); // Create an item in inbox. ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), DistinguishedFolderIdNameType.inbox.ToString(), itemName2); Site.Assert.IsNotNull(itemId, "Item should be created successfully!"); // Variable to indicate whether the item2 is created properly. bool isItem2Created = this.FindItem(DistinguishedFolderIdNameType.inbox.ToString(), itemName2) != null; Site.Assert.IsTrue(isItem2Created, "The item should be created successfully in the specific folder."); #endregion #region Empty the inbox folder // Specify which folder will be emptied. DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.inbox; // Empty the specific folder EmptyFolderResponseType emptyFolderResponse = this.CallEmptyFolderOperation(folderId, DisposalType.HardDelete, true); // Check the response. Common.CheckOperationSuccess(emptyFolderResponse, 1, this.Site); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3474"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3474 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, emptyFolderResponse.ResponseMessages.Items[0].ResponseClass, 3474, @"[In EmptyFolder Operation]A successful EmptyFolder operation request returns an EmptyFolderResponse element with the ResponseClass attribute of the EmptyFolderResponseMessage element set to ""Success""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R34744"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R34744 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, emptyFolderResponse.ResponseMessages.Items[0].ResponseCode, 34744, @"[In EmptyFolder Operation]A successful EmptyFolder operation request returns an EmptyFolderResponse element with the ResponseCode element of the EmptyFolderResponse element set to ""NoError""."); #region Find the item in inbox to see whether it has been deleted // Verify if item under inbox exists. bool isInboxItemDeleted = this.IfItemDeleted(DistinguishedFolderIdNameType.inbox.ToString(), itemName2); #endregion #region Get the folder in inbox folder to verify whether it has been deleted // GetFolder request. GetFolderType getFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, newFolderId); // Get the specific folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getFolderRequest); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Error, getFolderResponse.ResponseMessages.Items[0].ResponseClass, "Folder information should not be returned! "); // Variable to indicate whether the folder in inbox folder is deleted. bool isFolderDeleted = getFolderResponse.ResponseMessages.Items[0].ResponseCode == ResponseCodeType.ErrorItemNotFound; bool isItemDeleted = isInboxItemDeleted && this.IfItemDeleted(DistinguishedFolderIdNameType.inbox.ToString(), itemName1); #endregion // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R367"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R367. bool isVerifyR367 = isItemDeleted && isFolderDeleted; Site.Assert.IsTrue( isVerifyR367, "The expected result of deleting item should be \"true\", actual result is {0};\n" + "the expected result of deleting folder should be \"true\", actual result is {1}.\n ", isItemDeleted, isFolderDeleted); Site.CaptureRequirementIfIsTrue( isVerifyR367, 367, @"[In Elements]EmptyFolder specifies a request to empty folders in a mailbox in the server store."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R571"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R571. bool isVerifyR571 = isItemDeleted && isFolderDeleted; Site.Assert.IsTrue( isVerifyR571, "The expected result of deleting item should be \"true\", actual result is {0};\n" + "the expected result of deleting folder should be \"true\", actual result is {1}.\n ", isItemDeleted, isFolderDeleted); Site.CaptureRequirementIfIsTrue( isVerifyR571, 571, @"[In m:EmptyFolderType Complex Type]The EmptyFolderType complex type specifies a request message to empty a folder in a mailbox."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R380"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R380. // DeleteSubFolders has been set as true, if the subfolder is deleted, this requirement can be captured. Site.CaptureRequirementIfIsTrue( isFolderDeleted, 380, @"[In m:EmptyFolderType Complex Type]The DeleteSubFolders attribute is set to ""true"" if the subfolders are to be deleted."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5664"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5664 bool isVerifiedR5664 = isItemDeleted && isFolderDeleted; Site.Assert.IsTrue( isVerifiedR5664, "The expected result of deleting item should be \"true\", actual result is {0};\n" + "the expected result of deleting folder should be \"true\", actual result is {1}.\n ", isItemDeleted, isFolderDeleted); this.Site.CaptureRequirementIfIsTrue( isVerifiedR5664, 5664, @"[In Appendix C: Product Behavior] Implementation does include the EmptyFolder operation.(Exchange Server 2010 SP2 and above follow this behavior.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R37801"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R37801 bool isVerifiedR37801 = isItemDeleted && isFolderDeleted; Site.Assert.IsTrue( isVerifiedR37801, "The expected result of deleting item should be \"true\", actual result is {0};\n" + "the expected result of deleting folder should be \"true\", actual result is {1}.\n ", isItemDeleted, isFolderDeleted); this.Site.CaptureRequirementIfIsTrue( isVerifiedR37801, 37801, @"[In m:EmptyFolderType Complex Type ]DeleteType which value is HardDelete specifies that an item or folder is permanently removed from the store."); }