vbadirectoryimanage

How to get the names of files stored in a particular folder on iManage?


Is there any way in VBA to list the files stored in a particular folder on Worksite/iManage by referencing a FolderID?

What I would like to achieve is to get all files and list them in the spreadsheet in column A just like you can get the contents of a folder from an ordinary disk directory.

In imanage the file name would be iManDocument.Description.

Below is what I have come up with so far. I don't know how to move forward with this :(

Dim dmsRoot As IManDMS
Dim dmsSession As IManSession
Dim dmsDatabase As IManDatabase
Dim iFile As IManDocument
Dim iFdr as ImanFolder
DimFname as String

Const ServerName As String = "DMSname"
Const DatabaseName As String = "DatabaseName"
Const ifID as long = "123456"

Set dmsRoot = New ManDMS
Set dmsSession = dmsRoot.Sessions.Add(ServerName)
dmsSession.TrustedLogin

Set dmsDatabase = dmsSession.Databases.ItemByName(DatabaseName)

Set iFlr = dmsDatabase.GetFolder(ifID)

What I normally would do is create a loop

For each iFile in iFlr

  Fname = IFile.Description

and put the name in cells one by one but the ImanFolder doesn't seem to have such properties.

Some help wih this would be really appreciated.


Solution

  • IManage folders have a Contents property that contains the items stored in it. You can enumerate through the contents, casting to a IManDocument where possible, and getting the properties from that. Something akin to the following should work:

    Dim folderItem As IManContent
    Dim currentImanDoc As IManDocument
    
    .... Get your folder  
    
    For Each folderItem In currentIManFolder.Contents
        FName = folderItem .Description
    Next