/// <summary> /// This ROP creates a new subfolder. /// </summary> /// <param name="handle">The handle to operate.</param> /// <param name="createFolderResponse">The response of this ROP.</param> /// <param name="displayName">The name of the created folder. </param> /// <param name="comment">The folder comment that is associated with the created folder.</param> /// <param name="needVerify">Whether need to verify the response.</param> /// <returns>The handle of new folder.</returns> private uint RopCreateFolder(uint handle, out RopCreateFolderResponse createFolderResponse, string displayName, string comment, bool needVerify) { this.rawDataValue = null; this.responseValue = null; this.responseSOHsValue = null; RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest() { RopId = (byte)RopId.RopCreateFolder, LogonId = LogonId, InputHandleIndex = (byte)HandleIndex.FirstIndex, OutputHandleIndex = (byte)HandleIndex.SecondIndex, FolderType = (byte)FolderType.Genericfolder, UseUnicodeStrings = Convert.ToByte(false), OpenExisting = Convert.ToByte(true), Reserved = ReservedValue, DisplayName = Encoding.ASCII.GetBytes(displayName + "\0"), Comment = Encoding.ASCII.GetBytes(comment + "\0") }; this.responseSOHsValue = this.ProcessSingleRop(createFolderRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse); createFolderResponse = (RopCreateFolderResponse)this.responseValue; if (needVerify) { this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, createFolderResponse.ReturnValue, string.Format("RopCreateFolder Failed! Error: 0x{0:X8}", createFolderResponse.ReturnValue)); } return(this.responseSOHsValue[0][createFolderResponse.OutputHandleIndex]); }
/// <summary> /// Creates either public folders or private mailbox folders. /// </summary> /// <param name="ropCreateFolderRequest">RopCreateFolderRequest object.</param> /// <param name="insideObjHandle">Server object handle in RopCreateFolderRequest.</param> /// <param name="responseSOHTable">Server objects handles in RopCreateFolderResponse.</param> /// <returns>RopCreateFolderResponse object.</returns> public RopCreateFolderResponse CreateFolder(RopCreateFolderRequest ropCreateFolderRequest, uint insideObjHandle, ref List <List <uint> > responseSOHTable) { object temp = new object(); this.ExcuteRopCall((ISerializable)ropCreateFolderRequest, insideObjHandle, ref temp, ref responseSOHTable, ref this.rawData); RopCreateFolderResponse ropCreateFolderResponse = (RopCreateFolderResponse)temp; #region Capture Code // The ReturnValue equal to 0x00000000 indicate ROP operation success if (0x00000000 == ropCreateFolderResponse.ReturnValue) { this.VerifyRopCreateFolder(ropCreateFolderResponse); } #endregion return(ropCreateFolderResponse); }
/// <summary> /// Initialize a generic folder under inbox as a root folder for test. /// </summary> protected void GenericFolderInitialization() { RopLogonResponse logonResponse = this.Logon(LogonFlags.Private, out this.logonHandle); #region Open the inbox folder. RopOpenFolderRequest openFolderRequest = new RopOpenFolderRequest { RopId = (byte)RopId.RopOpenFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderId = logonResponse.FolderIds[Constants.InboxIndex], OpenModeFlags = (byte)FolderOpenModeFlags.OpenSoftDeleted }; // Use the logon object as input handle here. RopOpenFolderResponse openFolderResponse = this.Adapter.OpenFolder(openFolderRequest, this.LogonHandle, ref this.responseHandles); this.inboxFolderHandle = this.responseHandles[0][openFolderResponse.OutputHandleIndex]; #endregion #region Create a generic folder for test. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest(); RopCreateFolderResponse createFolderResponse = new RopCreateFolderResponse(); createFolderRequest.RopId = (byte)RopId.RopCreateFolder; createFolderRequest.LogonId = Constants.CommonLogonId; createFolderRequest.InputHandleIndex = Constants.CommonInputHandleIndex; createFolderRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; createFolderRequest.FolderType = 0x01; createFolderRequest.UseUnicodeStrings = 0x0; createFolderRequest.OpenExisting = 0x01; createFolderRequest.Reserved = 0x0; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(this.RootFolder); createFolderRequest.Comment = Encoding.ASCII.GetBytes(this.RootFolder); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.inboxFolderHandle, ref this.responseHandles); Site.Assert.AreEqual <uint>(0, createFolderResponse.ReturnValue, "Creating Folder should succeed."); this.rootFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; this.rootFolderId = createFolderResponse.FolderId; this.isRootFolderCreated = true; #endregion }
/// <summary> /// Creates a new Folder. /// </summary> /// <param name="parentFolderHandle">The parent folder under which the new folder will be created.</param> /// <param name="folderName">Folder Name which will be created.</param> /// <param name="folderId">Folder Id which will be returned by server.</param> /// <param name="folderHandle">Folder Handle which will be returned by server.</param> /// <returns>The RopCreateFolder ROP response buffer.</returns> protected RopCreateFolderResponse CreateFolder(uint parentFolderHandle, string folderName, ref ulong folderId, ref uint folderHandle) { RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = 0x01, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(folderName), Comment = Encoding.ASCII.GetBytes(folderName) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, parentFolderHandle, ref this.responseHandles); Site.Assert.AreEqual <uint>(0, createFolderResponse.ReturnValue, "Creating Folder should succeed."); folderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; folderId = createFolderResponse.FolderId; return(createFolderResponse); }