-1

I want to create a folder in DeskSite using the IManage API. can someone please give example. Any help will be appreciated.

Yoky
  • 832
  • 10
  • 20
  • 3
    This question shows very little effort. Have you searched for examples yourself? – Xorifelse Mar 23 '16 at 17:19
  • Of course I did. I'm totally new to DMS and couldn't come up with something. I don't have a clue that's why came to you guys for some. – Yoky Mar 23 '16 at 17:22
  • Welcome to SO. Please read "[ask]", along with http://meta.stackoverflow.com/q/261592/128421 - "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](http://meta.stackoverflow.com/questions/254393) and what has been done so far to solve it." – the Tin Man Mar 25 '16 at 17:48

1 Answers1

2

I got answer and hope this will help someone out there.

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();
        }
    }
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Yoky
  • 832
  • 10
  • 20