我想使用IManage API在DeskSite中创建一个文件夹。有人可以举个例子。 任何帮助将不胜感激。
答案 0 :(得分:2)
我得到了答案,希望这能帮助那些人。
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();
}
}