/// <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); }
protected override void EndInvoke(IAsyncResult asyncResult) { GetFolderResponseType getFolderResponseType = this.binding.EndGetFolder(asyncResult); if (getFolderResponseType.ResponseMessages == null || getFolderResponseType.ResponseMessages.Items == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL ResponseMessages.", new object[] { TraceContext.Get() }); this.SetErrorResultOnUnexpectedResponse(); return; } FolderInfoResponseMessageType folderInfoResponseMessageType = getFolderResponseType.ResponseMessages.Items[0] as FolderInfoResponseMessageType; if (folderInfoResponseMessageType == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL FolderInfoResponseMessageType.", new object[] { TraceContext.Get() }); this.SetErrorResultOnUnexpectedResponse(); return; } if (folderInfoResponseMessageType.ResponseCode != ResponseCodeType.NoError) { GetFolderRequest.GetFolderRequestTracer.TraceDebug <object, ResponseCodeType>((long)this.GetHashCode(), "{0}: GetFolder web request returned ResponseCodeType {1}.", TraceContext.Get(), folderInfoResponseMessageType.ResponseCode); this.SetErrorResultOnUnexpectedResponse(); return; } if (folderInfoResponseMessageType.Folders == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL Folders.", new object[] { TraceContext.Get() }); this.SetErrorResultOnUnexpectedResponse(); return; } BaseFolderType baseFolderType = folderInfoResponseMessageType.Folders[0]; if (baseFolderType == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress>((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL FolderResponse for mailbox {1}.", TraceContext.Get(), this.query.Email); this.SetErrorResultOnUnexpectedResponse(); return; } this.ResultFolderId = baseFolderType.FolderId.Id; GetFolderRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress, string>((long)this.GetHashCode(), "{0}: GetFolder web request returned folder id {2} for mailbox {1}.", TraceContext.Get(), this.query.Email, this.ResultFolderId); }
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 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."); }
/// <summary> /// Verify GetFolder operation requirements. /// </summary> /// <param name="getFolderResponse"> Get folder response message returned from server.</param> /// <param name="isSchemaValidated"> A Boolean value indicates the schema validation result. "true" means success, "false" means failure.</param> private void VerifyGetFolderResponse(GetFolderResponseType getFolderResponse, bool isSchemaValidated) { FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0]; // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R386."); // Verify MS-OXWSFOLD_R386. Site.CaptureRequirementIfIsTrue( isSchemaValidated, 386, @"[In GetFolder Operation]The following is the WSDL port type specification of the GetFolder operation. <wsdl:operation name=""GetFolder""> <wsdl:input message=""tns:GetFolderSoapIn"" /> <wsdl:output message=""tns:GetFolderSoapOut"" /> </wsdl:operation>"); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R411."); // Verify MS-OXWSFOLD_R411. Site.CaptureRequirementIfIsTrue( isSchemaValidated, 411, @"[In GetFolderResponse Element][The GetFolderResponse element is defined as:] <xs:element name=""GetFolderResponse"" type=""m:GetFolderResponseType"" />"); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R418."); // Verify MS-OXWSFOLD_R418. Site.CaptureRequirementIfIsTrue( isSchemaValidated, 418, @"[In m:GetFolderResponseType Complex Type][The schema of GetFolderResponseType is defined as:]<xs:complexType name=""GetFolderResponseType""> <xs:complexContent> <xs:extension base=""m:BaseResponseMessageType"" /> </xs:complexContent> </xs:complexType>"); if (allFolders.Folders[0] is FolderType && ((FolderType)allFolders.Folders[0]).PermissionSet != null) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R97"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R97 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 97, @"[In t:FolderType Complex Type][The schema of FolderType is defined as:] <xs:complexType name=""FolderType""> <xs:complexContent> <xs:extension base=""t:BaseFolderType"" > <xs:sequence> <xs:element name=""PermissionSet"" type=""t:PermissionSetType"" minOccurs=""0"" /> <xs:element name=""UnreadCount"" type=""xs:int"" minOccurs=""0"" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); } if ((allFolders.Folders[0] is FolderType && ((FolderType)allFolders.Folders[0]).PermissionSet != null) || (allFolders.Folders[0] is ContactsFolderType && ((ContactsFolderType)allFolders.Folders[0]).PermissionSet != null) || (allFolders.Folders[0] is TasksFolderType && ((TasksFolderType)allFolders.Folders[0]).PermissionSet != null)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R143"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R143 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 143, @"[In t:PermissionLevelType Simple Type][The schema of PermissionLevelType is defined as:] <xs:simpleType name=""PermissionLevelType""> <xs:restriction base=""xs:string"" > <xs:enumeration value=""None"" /> <xs:enumeration value=""Owner"" /> <xs:enumeration value=""PublishingEditor"" /> <xs:enumeration value=""Editor"" /> <xs:enumeration value=""PublishingAuthor"" /> <xs:enumeration value=""Author"" /> <xs:enumeration value=""NoneditingAuthor"" /> <xs:enumeration value=""Reviewer"" /> <xs:enumeration value=""Contributor"" /> <xs:enumeration value=""Custom"" /> </xs:restriction> </xs:simpleType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R43"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R43 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 43, @"[In t:BasePermissionType Complex Type]The type of element UserId is t:UserIdType ([MS-OXWSCDATA] section 2.2.4.62)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R44"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R44 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 44, @"[In t:BasePermissionType Complex Type]This element [UserId] MUST be present."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R117"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R117 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 117, @"[In t:PermissionSetType Complex Type][The schema of PermissionSetType is defined as:]<xs:complexType name=""PermissionSetType""> <xs:sequence> <xs:element name=""Permissions"" type=""t:ArrayOfPermissionsType"" /> <xs:element name=""UnknownEntries"" type=""t:ArrayOfUnknownEntriesType"" minOccurs=""0"" /> </xs:sequence> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R118"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R118 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 118, @"[In t:PermissionSetType Complex Type]The type of element Permissions is t:ArrayOfPermissionsType ([MS-OXWSCDATA] section 2.2.4.9)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R121"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R121 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 121, @"[In t:PermissionType Complex Type][The schema of PermissionType is defined as:] <xs:complexType name=""PermissionType""> <xs:complexContent> <xs:extension base=""t:BasePermissionType"" > <xs:sequence> <xs:element name=""ReadItems"" type=""t:PermissionReadAccessType"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""PermissionLevel"" type=""t:PermissionLevelType"" minOccurs=""1"" maxOccurs=""1"" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R123"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R123 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 123, @"[In t:PermissionType Complex Type]The type of element PermissionLevel is t:PermissionLevelType (section 2.2.5.3)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R138"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R138 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 138, @"[In t:PermissionActionType Simple Type][The schema of PermissionActionType is defined as:] <xs:simpleType name=""PermissionActionType""> <xs:restriction base=""xs:string"" > <xs:enumeration value=""None"" /> <xs:enumeration value=""Owned"" /> <xs:enumeration value=""All"" /> </xs:restriction> </xs:simpleType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R155"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R155 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 155, @"[In t:PermissionReadAccessType Simple Type][The schema of PermissionReadAccessType is defined as:] <xs:simpleType name=""PermissionReadAccessType""> <xs:restriction base=""xs:string"" > <xs:enumeration value=""None"" /> <xs:enumeration value=""FullDetails"" /> </xs:restriction> </xs:simpleType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1014"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1014 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, "MS-OXWSCDATA", 1014, @"[In t:ArrayOfPermissionsType Complex Type] The type [ArrayOfPermissionsType] is defined as follow: <xs:complexType name=""ArrayOfPermissionsType""> <xs:choice minOccurs=""0"" maxOccurs=""unbounded"" > <xs:element name=""Permission"" type=""t:PermissionType"" /> </xs:choice> </xs:complexType>"); } foreach (BaseFolderType folder in allFolders.Folders) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6603, length of folder id is:{0}", folder.FolderId.Id.Length); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6603 bool isVerifiedR6603 = folder.FolderId.Id.Length <= 512; this.Site.CaptureRequirementIfIsTrue( isVerifiedR6603, 6603, @"[In t:BaseFolderType Complex Type]The maximum length for the FolderIdType element Id attribute is 512 bytes after base64 decoding."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6604, length of folder change key is:{0}", folder.FolderId.ChangeKey.Length); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6604 bool isVerifiedR6604 = folder.FolderId.ChangeKey.Length <= 512; this.Site.CaptureRequirementIfIsTrue( isVerifiedR6604, 6604, @"[In t:BaseFolderType Complex Type]The maximum length for the FolerIdType ChangeKey attribute is 512 bytes after base64 decoding."); if (folder.ParentFolderId != null) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6803, length of parent folder id is:{0}", folder.ParentFolderId.Id.Length); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6803 bool isVerifiedR6803 = folder.ParentFolderId.Id.Length <= 512; this.Site.CaptureRequirementIfIsTrue( isVerifiedR6803, 6803, @"[In t:BaseFolderType Complex Type]The maximum length for the FolderIdType element Id attribute is 512 bytes after base64 decoding."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6804, length of parent folder id is:{0}", folder.ParentFolderId.ChangeKey.Length); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6804 bool isVerifiedR6804 = folder.ParentFolderId.ChangeKey.Length <= 512; this.Site.CaptureRequirementIfIsTrue( isVerifiedR6804, 6804, @"[In t:BaseFolderType Complex Type]The maximum length for the FolerIdType ChangeKey attribute is 512 bytes after base64 decoding."); } } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R95"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R95 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 95, @"[In m:FolderInfoResponseMessageType Complex Type][The schema of FolderInfoResponseMessageType is defined as:]<xs:complexType name=""FolderInfoResponseMessageType""> <xs:complexContent> <xs:extension base=""m:ResponseMessageType"" > <xs:sequence> <xs:element name=""Folders"" type=""t:ArrayOfFoldersType"" minOccurs=""0"" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R137"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R137 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 137, @"[In t:FolderClassType Simple Type][The schema of FolderClassType is defined as:] <xs:simpleType name=""FolderClassType""> <xs:restriction base=""xs:string"" /> </xs:simpleType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3862"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3862 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 3862, @"[In GetFolder Operation][The WSDL binding of GetFolder operation is defined as:]<wsdl:operation name=""GetFolder""> <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/GetFolder"" /> <wsdl:input> <soap:header message=""tns:GetFolderSoapIn"" part=""Impersonation"" use=""literal""/> <soap:header message=""tns:GetFolderSoapIn"" part=""MailboxCulture"" use=""literal""/> <soap:header message=""tns:GetFolderSoapIn"" part=""RequestVersion"" use=""literal""/> <soap:header message=""tns:GetFolderSoapIn"" part=""TimeZoneContext"" use=""literal""/> <soap:body parts=""request"" use=""literal"" /> </wsdl:input> <wsdl:output> <soap:body parts=""GetFolderResult"" use=""literal"" /> <soap:header message=""tns:GetFolderSoapOut"" part=""ServerVersion"" use=""literal""/> </wsdl:output> </wsdl:operation>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3863"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3863 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 3863, @"[In GetFolder Operation]The protocol client sends a GetFolderSoapIn request WSDL message, and the protocol server responds with a GetFolderSoapOut response WSDL message."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4024"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4024 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 4024, @"[In tns:GetFolderSoapOut Message][The response WSDL message of GetFolder operation is defined as:]<wsdl:message name=""GetFolderSoapOut""> <wsdl:part name=""GetFolderResult"" element=""tns:GetFolderResponse"" /> <wsdl:part name=""ServerVersion"" element=""t:ServerVersionInfo""/> </wsdl:message>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R404"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R404 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 404, @"[In tns:GetFolderSoapOut Message]GetFolderResult which Element/Type is tns:GetFolderResponse (section 3.1.4.6.2.2)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4041"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4041 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 4041, @"[In tns:GetFolderSoapOut Message]GetFolderResult specifies the SOAP body of the response to a GetManagedFolder operation request."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R405"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R405 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 405, @"[In tns:GetFolderSoapOut Message]ServerVersion which Element/Type is t:ServerVersionInfo ([MS-OXWSCDATA] section 2.2.3.12)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R406"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R406 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 406, @"[In tns:GetFolderSoapOut Message]ServerVersion specifies a SOAP header that identifies the server version for the response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1129"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1129 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, "MS-OXWSCDATA", 1129, @"[In t:EffectiveRightsType Complex Type] The type [EffectiveRightsType] is defined as follow: <xs:complexType name=""EffectiveRightsType""> <xs:sequence> <xs:element name=""CreateAssociated"" type=""xs:boolean"" /> <xs:element name=""CreateContents"" type=""xs:boolean"" /> <xs:element name=""CreateHierarchy"" type=""xs:boolean"" /> <xs:element name=""Delete"" type=""xs:boolean"" /> <xs:element name=""Modify"" type=""xs:boolean"" /> <xs:element name=""Read"" type=""xs:boolean"" /> <xs:element name=""ViewPrivateItems"" type=""xs:boolean"" /> </xs:sequence> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1165"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1165 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, "MS-OXWSCDATA", 1165, @"[In t:FolderIdType Complex Type] The type [FolderIdType] is defined as follow: <xs:complexType name=""FolderIdType""> <xs:complexContent> <xs:extension base=""t:BaseFolderIdType"" > <xs:attribute name=""Id"" type=""xs:string"" use=""required"" /> <xs:attribute name=""ChangeKey"" type=""xs:string"" use=""optional"" /> </xs:extension> </xs:complexContent> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1297"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1297 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, "MS-OXWSCDATA", 1297, @"[In t:UserIdType Complex Type] The type [UserIdType] is defined as follow: <xs:complexType name=""UserIdType""> <xs:sequence> <xs:element name=""SID"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""PrimarySmtpAddress"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""DisplayName"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""DistinguishedUser"" type=""t:DistinguishedUserType"" minOccurs=""0"" maxOccurs=""1"" /> <xs:element name=""ExternalUserIdentity"" type=""xs:string"" minOccurs=""0"" maxOccurs=""1"" /> </xs:sequence> </xs:complexType>"); if (allFolders.Folders[0].ManagedFolderInformation != null) { // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R102."); // Verify MS-OXWSFOLD_R102. Site.CaptureRequirementIfIsTrue( isSchemaValidated, 102, @"[In t:ManagedFolderInformationType Complex Type][The schema of ManagedFolderInformationType is defined as:] <xs:complexType name=""ManagedFolderInformationType""> <xs:sequence> <xs:element name=""CanDelete"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""CanRenameOrMove"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""MustDisplayComment"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""HasQuota"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""IsManagedFoldersRoot"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""ManagedFolderId"" type=""xs:string"" minOccurs=""0"" /> <xs:element name=""Comment"" type=""xs:string"" minOccurs=""0"" /> <xs:element name=""StorageQuota"" type=""xs:int"" minOccurs=""0"" /> <xs:element name=""FolderSize"" type=""xs:int"" minOccurs=""0"" /> <xs:element name=""HomePage"" type=""xs:string"" minOccurs=""0"" /> </xs:sequence> </xs:complexType>"); if (allFolders.Folders[0].ManagedFolderInformation.CanDeleteSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R103"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R103 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 103, @"[In t:ManagedFolderInformationType Complex Type]The type of element CanDelete is xs:boolean [XMLSCHEMA2]."); } if (allFolders.Folders[0].ManagedFolderInformation.CanRenameOrMoveSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R105"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R105 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 105, @"[In t:ManagedFolderInformationType Complex Type]The type of element CanRenameOrMove is xs:boolean."); } if (allFolders.Folders[0].ManagedFolderInformation.MustDisplayCommentSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R106"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R106 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 106, @"[In t:ManagedFolderInformationType Complex Type]The type of element MustDisplayComment is xs:boolean."); } if (allFolders.Folders[0].ManagedFolderInformation.HasQuotaSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R107"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R107 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 107, @"[In t:ManagedFolderInformationType Complex Type]The type of element HasQuota is xs:boolean."); } if (allFolders.Folders[0].ManagedFolderInformation.IsManagedFoldersRootSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R108"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R108 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 108, @"[In t:ManagedFolderInformationType Complex Type]The type of element IsManagedFoldersRoot is xs:boolean."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R109"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R109 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 109, @"[In t:ManagedFolderInformationType Complex Type]The type of element ManageFolderId is xs:string [XMLSCHEMA2]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R111"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R111 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 111, @"[In t:ManagedFolderInformationType Complex Type]The type of element Comment is xs:string."); if (allFolders.Folders[0].ManagedFolderInformation.StorageQuotaSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R112"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R112 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 112, @"[In t:ManagedFolderInformationType Complex Type]The type of element StorageQuota is xs:int [XMLSCHEMA2]."); } if (allFolders.Folders[0].ManagedFolderInformation.FolderSizeSpecified == true) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R114"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R114 this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 114, @"[In t:ManagedFolderInformationType Complex Type]The type of element FolderSize is xs:int."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R79"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R79 // All elements of ManagedFolderInformation have been verified by capture codes above (R103 to R114), so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 79, @"[In t:BaseFolderType Complex Type]The type of element ManagedFolderInformation is t:ManagedFolderInformationType (section 2.2.4.11)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R7901"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R7901 // All elements of ManagedFolderInformation have been verified by capture codes above (R103 to R114), so this requirement can be captured. this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 7901, @"[In t:BaseFolderType Complex Type]ManagedFolderInformation specifies metadata for a managed folder."); } }
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 }
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."); }
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."); }
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"". "); }
public void MSOXWSFOLD_S08_TC01_AllOperationsWithAllOptionalElements() { #region Configure SOAP header this.ConfigureSOAPHeader(); #endregion #region Create new folders in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest( DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder1", "Custom Folder2", "Custom Folder3", "Custom Folder4" }, new string[] { "IPF.MyCustomFolderClass", "IPF.Appointment", "IPF.Contact", "IPF.Task" }, null); // Set ExtendedProperty defined in BaseFolderType. PathToExtendedFieldType publishInAddressBook = new PathToExtendedFieldType(); // A hexadecimal tag of the extended property. publishInAddressBook.PropertyTag = "0x671E"; publishInAddressBook.PropertyType = MapiPropertyTypeType.Boolean; ExtendedPropertyType pubAddressbook = new ExtendedPropertyType(); pubAddressbook.ExtendedFieldURI = publishInAddressBook; pubAddressbook.Item = "1"; ExtendedPropertyType[] extendedProperties = new ExtendedPropertyType[1]; extendedProperties[0] = pubAddressbook; createFolderRequest.Folders[0].ExtendedProperty = extendedProperties; createFolderRequest.Folders[1].ExtendedProperty = extendedProperties; createFolderRequest.Folders[2].ExtendedProperty = extendedProperties; createFolderRequest.Folders[3].ExtendedProperty = extendedProperties; // Define a permissionSet with all optional elements PermissionSetType permissionSet = new PermissionSetType(); permissionSet.Permissions = new PermissionType[1]; permissionSet.Permissions[0] = new PermissionType(); permissionSet.Permissions[0].ReadItems = new PermissionReadAccessType(); permissionSet.Permissions[0].ReadItems = PermissionReadAccessType.FullDetails; permissionSet.Permissions[0].ReadItemsSpecified = true; permissionSet.Permissions[0].CanCreateItems = true; permissionSet.Permissions[0].CanCreateItemsSpecified = true; permissionSet.Permissions[0].CanCreateSubFolders = true; permissionSet.Permissions[0].CanCreateSubFoldersSpecified = true; permissionSet.Permissions[0].IsFolderVisible = true; permissionSet.Permissions[0].IsFolderVisibleSpecified = true; permissionSet.Permissions[0].IsFolderContact = true; permissionSet.Permissions[0].IsFolderContactSpecified = true; permissionSet.Permissions[0].IsFolderOwner = true; permissionSet.Permissions[0].IsFolderOwnerSpecified = true; permissionSet.Permissions[0].IsFolderContact = true; permissionSet.Permissions[0].IsFolderContactSpecified = true; permissionSet.Permissions[0].EditItems = new PermissionActionType(); permissionSet.Permissions[0].EditItems = PermissionActionType.All; permissionSet.Permissions[0].EditItemsSpecified = true; permissionSet.Permissions[0].DeleteItems = new PermissionActionType(); permissionSet.Permissions[0].DeleteItems = PermissionActionType.All; permissionSet.Permissions[0].DeleteItemsSpecified = true; permissionSet.Permissions[0].PermissionLevel = new PermissionLevelType(); permissionSet.Permissions[0].PermissionLevel = PermissionLevelType.Custom; permissionSet.Permissions[0].UserId = new UserIdType(); permissionSet.Permissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); // Set PermissionSet for FolderType folder. ((FolderType)createFolderRequest.Folders[0]).PermissionSet = permissionSet; // Set PermissionSet for ContactsType folder. ((ContactsFolderType)createFolderRequest.Folders[2]).PermissionSet = permissionSet; // Set PermissionSet for TasksFolderType folder. ((TasksFolderType)createFolderRequest.Folders[3]).PermissionSet = permissionSet; // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 4, this.Site); // Folder ids. FolderIdType[] folderIds = new FolderIdType[createFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < createFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, createFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be created successfully!"); // Save folder ids. folderIds[index] = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderIds[index]); } #endregion #region Create a managedfolder CreateManagedFolderRequestType createManagedFolderRequest = this.GetCreateManagedFolderRequest(Common.GetConfigurationPropertyValue("ManagedFolderName1", this.Site)); // Add an email address into request. EmailAddressType mailBox = new EmailAddressType() { EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) }; createManagedFolderRequest.Mailbox = mailBox; // Create the specified managed folder. CreateManagedFolderResponseType createManagedFolderResponse = this.FOLDAdapter.CreateManagedFolder(createManagedFolderRequest); // Check the response. Common.CheckOperationSuccess(createManagedFolderResponse, 1, this.Site); // Save the new created managed folder's folder id. FolderIdType newFolderId = ((FolderInfoResponseMessageType)createManagedFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newFolderId); #endregion #region Get the new created folders // GetFolder request. GetFolderType getCreatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderIds); // Get the new created folder. GetFolderResponseType getCreatedFolderResponse = this.FOLDAdapter.GetFolder(getCreatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getCreatedFolderResponse, 4, this.Site); for (int index = 0; index < getCreatedFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, getCreatedFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder information should be returned!"); } #endregion #region Update the new created folders // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest( new string[] { "Folder", "CalendarFolder", "ContactsFolder", "TasksFolder" }, new string[] { "SetFolderField", "SetFolderField", "SetFolderField", "SetFolderField" }, folderIds); // Update the folders' properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 4, this.Site); for (int index = 0; index < updateFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Copy the updated folders to "drafts" folder // Copy the folders into "drafts" folder CopyFolderType copyFolderRequest = this.GetCopyFolderRequest(DistinguishedFolderIdNameType.drafts.ToString(), folderIds); // Copy the folders. CopyFolderResponseType copyFolderResponse = this.FOLDAdapter.CopyFolder(copyFolderRequest); // Check the response. Common.CheckOperationSuccess(copyFolderResponse, 4, this.Site); // Copied Folders' id. FolderIdType[] copiedFolderIds = new FolderIdType[copyFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < copyFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, copyFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); // Variable to save the folders. copiedFolderIds[index] = ((FolderInfoResponseMessageType)copyFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the copied folders' folder id. this.NewCreatedFolderIds.Add(copiedFolderIds[index]); } #endregion #region Move the updated folders to "deleteditems" folder // MoveFolder request. MoveFolderType moveFolderRequest = new MoveFolderType(); // Set the request's folderId field. moveFolderRequest.FolderIds = folderIds; // Set the request's destFolderId field. DistinguishedFolderIdType toFolderId = new DistinguishedFolderIdType(); toFolderId.Id = DistinguishedFolderIdNameType.deleteditems; moveFolderRequest.ToFolderId = new TargetFolderIdType(); moveFolderRequest.ToFolderId.Item = toFolderId; // Move the specified folders. MoveFolderResponseType moveFolderResponse = this.FOLDAdapter.MoveFolder(moveFolderRequest); // Check the response. Common.CheckOperationSuccess(moveFolderResponse, 4, this.Site); for (int index = 0; index < moveFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, moveFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Delete all folders // All folder ids. FolderIdType[] allFolderIds = new FolderIdType[folderIds.Length + copiedFolderIds.Length]; for (int index = 0; index < allFolderIds.Length / 2; index++) { allFolderIds[index] = folderIds[index]; allFolderIds[index + folderIds.Length] = copiedFolderIds[index]; } // DeleteFolder request. DeleteFolderType deleteFolderRequest = this.GetDeleteFolderRequest(DisposalType.HardDelete, allFolderIds); // Delete the specified folder. DeleteFolderResponseType deleteFolderResponse = this.FOLDAdapter.DeleteFolder(deleteFolderRequest); // Check the response. Common.CheckOperationSuccess(deleteFolderResponse, 8, this.Site); for (int index = 0; index < deleteFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, deleteFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion }
public void MSOXWSFOLD_S08_TC02_AllOperationsWithoutAllOptionalElements() { #region Create new folders in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest( DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder1", "Custom Folder2", "Custom Folder3", "Custom Folder4" }, new string[] { "IPF.MyCustomFolderClass", "IPF.Appointment", "IPF.Contact", "IPF.Task" }, null); // Remove FolderClass for FolderType folder. createFolderRequest.Folders[0].FolderClass = null; // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 4, this.Site); // Folder ids. FolderIdType[] folderIds = new FolderIdType[createFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < createFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, createFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be created successfully!"); // Save folder ids. folderIds[index] = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderIds[index]); } #endregion #region Create a managedfolder CreateManagedFolderRequestType createManagedFolderRequest = this.GetCreateManagedFolderRequest(Common.GetConfigurationPropertyValue("ManagedFolderName1", this.Site)); // Create the specified managed folder. CreateManagedFolderResponseType createManagedFolderResponse = this.FOLDAdapter.CreateManagedFolder(createManagedFolderRequest); // Check the response. Common.CheckOperationSuccess(createManagedFolderResponse, 1, this.Site); // Save the new created managed folder's folder id. FolderIdType newManagedFolderId = ((FolderInfoResponseMessageType)createManagedFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.NewCreatedFolderIds.Add(newManagedFolderId); #endregion #region Get the new created folders // GetFolder request. GetFolderType getCreatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderIds); // Get the new created folder. GetFolderResponseType getCreatedFolderResponse = this.FOLDAdapter.GetFolder(getCreatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getCreatedFolderResponse, 4, this.Site); for (int index = 0; index < getCreatedFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, getCreatedFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder information should be returned!"); } #endregion #region Update the new created folders // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest( new string[] { "Folder", "CalendarFolder", "ContactsFolder", "TasksFolder" }, new string[] { "SetFolderField", "SetFolderField", "SetFolderField", "SetFolderField" }, folderIds); // Update the folders' properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 4, this.Site); for (int index = 0; index < updateFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Copy the updated folders to "drafts" folder // Copy the folders into "drafts" folder CopyFolderType copyFolderRequest = this.GetCopyFolderRequest(DistinguishedFolderIdNameType.drafts.ToString(), folderIds); // Copy the folders. CopyFolderResponseType copyFolderResponse = this.FOLDAdapter.CopyFolder(copyFolderRequest); // Check the response. Common.CheckOperationSuccess(copyFolderResponse, 4, this.Site); // Copied folders' id. FolderIdType[] copiedFolderIds = new FolderIdType[copyFolderResponse.ResponseMessages.Items.Length]; for (int index = 0; index < copyFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, copyFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); // Variable to save the folders. copiedFolderIds[index] = ((FolderInfoResponseMessageType)copyFolderResponse.ResponseMessages.Items[index]).Folders[0].FolderId; // Save the copied folders' folder id. this.NewCreatedFolderIds.Add(copiedFolderIds[index]); } #endregion #region Move the updated folders to "deleteditems" folder // MoveFolder request. MoveFolderType moveFolderRequest = new MoveFolderType(); // Set the request's folderId field. moveFolderRequest.FolderIds = folderIds; // Set the request's destFolderId field. DistinguishedFolderIdType toFolderId = new DistinguishedFolderIdType(); toFolderId.Id = DistinguishedFolderIdNameType.deleteditems; moveFolderRequest.ToFolderId = new TargetFolderIdType(); moveFolderRequest.ToFolderId.Item = toFolderId; // Move the specified folders. MoveFolderResponseType moveFolderResponse = this.FOLDAdapter.MoveFolder(moveFolderRequest); // Check the response. Common.CheckOperationSuccess(moveFolderResponse, 4, this.Site); for (int index = 0; index < moveFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, moveFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion #region Delete all folders // All folder ids. FolderIdType[] allFolderIds = new FolderIdType[folderIds.Length + copiedFolderIds.Length]; for (int index = 0; index < allFolderIds.Length / 2; index++) { allFolderIds[index] = folderIds[index]; allFolderIds[index + folderIds.Length] = copiedFolderIds[index]; } // DeleteFolder request. DeleteFolderType deleteFolderRequest = this.GetDeleteFolderRequest(DisposalType.HardDelete, allFolderIds); // Delete the specified folder. DeleteFolderResponseType deleteFolderResponse = this.FOLDAdapter.DeleteFolder(deleteFolderRequest); // Check the response. Common.CheckOperationSuccess(deleteFolderResponse, 8, this.Site); for (int index = 0; index < deleteFolderResponse.ResponseMessages.Items.Length; index++) { Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, deleteFolderResponse.ResponseMessages.Items[index].ResponseClass, "Folder should be updated successfully!"); } #endregion }
public void MSOXWSFOLD_S06_TC01_UpdateFolder() { #region Create a new folder in the inbox folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); FolderIdType folderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(folderId); #endregion #region Update Folder Operation. // UpdateFolder request. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", folderId); // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site); string updateNameInRequest = ((SetFolderFieldType)updateFolderRequest.FolderChanges[0].Updates[0]).Item1.DisplayName; #endregion #region Get the updated folder. // GetFolder request. GetFolderType getUpdatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId); // Get the updated folder. GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getUpdatedFolderRequest); // Check the response. Common.CheckOperationSuccess(getFolderResponse, 1, this.Site); FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0]; FolderType gotFolderInfo = (FolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R46444"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R46444 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 46444, @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseClass attribute of the UpdateFolderResponseMessage element set to ""Success""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4644"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4644 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, updateFolderResponse.ResponseMessages.Items[0].ResponseCode, 4644, @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseCode element of the UpdateFolderResponse element set to ""NoError""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8902"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R8902 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 8902, @"[In t:FolderChangeType Complex Type]FolderId specifies the folder identifier and change key."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R582"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R582 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 582, @"[In m:UpdateFolderType Complex Type]The UpdateFolderType complex type specifies a request message to update folders in a mailbox. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R534"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R534 // Set a property on a FolderType folder successfully, indicates that Folder represents a regular folder. this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, updateFolderResponse.ResponseMessages.Items[0].ResponseClass, 534, @"[In t:SetFolderFieldType Complex Type]Folder represents a regular folder in the server database."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9301"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9301 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 9301, @"[In t:FolderChangeType Complex Type][Updates] Specifies a collection of changes to a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R546"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R546 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 546, @"[In t:FolderChangeType Complex Type]The FolderChangeType complex type specifies a collection of changes to be performed on a single folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5051"); // All folders updated successfully! this.Site.CaptureRequirement( 5051, @"[In m:UpdateFolderType Complex Type]FolderChanges represents an array of folders to be updated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R531"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R531 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 531, @"[In t:NonEmptyArrayOfFolderChangesType Complex Type]FolderChange represents a collection of changes to be performed on a single folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5251"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5251 this.Site.CaptureRequirementIfAreEqual <string>( updateNameInRequest, gotFolderInfo.DisplayName, 5251, @"[In t:NonEmptyArrayOfFolderChangeDescriptionsType Complex Type]SetFolderField represents an UpdateFolder operation to set a property on an existing folder."); }
public void MSOXWSFOLD_S06_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. "); }