在 IManage desksite C# 中创建文件夹

Create a folder in IManage desksite C#

我想使用 IManage API 在 DeskSite 中创建一个文件夹。有人可以举个例子吗? 任何帮助将不胜感激。

我得到了答案,希望这对那里的人有所帮助。

public void CreateFolder(string matterNo, string clientNo, string dbName, string serviceAccountName)
    {
        var folderName = "new folder name";
        var folderDesc = "new folder description";
        var workSpaceName = string.Format("{0}-{1}*", clientNo, matterNo);
        if (DMSSession.Connected)
        {
            IManWorkArea imanWorkArea = DMSSession.WorkArea;
            IManDatabase imanDatabase = DMSSession.Databases.ItemByName(dbName);
            //workspace search profile values
            IManProfileSearchParameters profileParameters = imanWorkArea.Session.DMS.CreateProfileSearchParameters();
            profileParameters.Add(IManage.imProfileAttributeID.imProfileAuthor, "*");

            //workspace search property values
            IManWorkspaceSearchParameters workSpaceParameters = imanWorkArea.Session.DMS.CreateWorkspaceSearchParameters();
            workSpaceParameters.Add(IManage.imFolderAttributeID.imFolderOwner, "*");
            workSpaceParameters.Add(IManage.imFolderAttributeID.imFolderName, workSpaceName);
            IManWorkspace imanWorkSpace = (IManWorkspace)imanDatabase.SearchWorkspaces(profileParameters, workSpaceParameters).ItemByIndex(1);
            var workSpaceId= imanWorkSpace.ObjectID;

            IManDMS mDms = DMSSession.DMS;
            IManWorkspace mWorkSpace = (IManWorkspace)mDms.GetObjectByID(workSpaceId);
            IManDocumentFolders mDocFolders = mWorkSpace.DocumentFolders;
            IManDocumentFolder mDocFolder = mDocFolders.AddNewDocumentFolder(folderName, folderDesc);
            //setting additional prpoerties

            mDocFolder.AdditionalProperties.Add("iMan___25", clientNo);
            mDocFolder.AdditionalProperties.Add("IMan___26", matterNo);

            //setting security
            mDocFolder.Security.DefaultVisibility = imSecurityType.imView;
            mDocFolder.Security.UserACLs.Add("userName", imAccessRight.imRightAll);
            mDocFolder.Update();
        }
    }