Downloading files from imanage/worksite/filesite

2019-08-21 23:33发布

I got this problem at work that I have to do a lot with iManage (aka FileSite, DeskSite, WorkSite etc.) and maybe you've heard of it.

Anyways, what I'm trying to do is to write a VBA code which will be able to download a particular file based on its InFin number (7-digit number that is assigned to every file when being uploaded to iManage) and then place the file somewhere; For example, on the Desktop. I know that iManage does expose an object model and I've already set the reference to IManExtLib.dll

I believe that the command I need is the Copy.Cmd (I don't want to cut sth from WorkSite but only download a copy of the file for the performed task).

Any help would be appreciated.

1条回答
戒情不戒烟
2楼-- · 2019-08-22 00:08

Assuming you already have a DMS session, you need to get an IManDocument object for your document you're trying to get and then call the GetCopy method. As an example, the following retrieves a physical copy of document number 123456 to a temp folder. Note you'll need to add a reference to IManage.dll as opposed to IManExtLib.dll.

Dim dmsRoot As IManDMS
Dim dmsSession As IManSession
Dim dmsDatabase As IManDatabase
Dim doc As IManDocument

Dim tempDocName As String

Const ServerName As String = "YourDMS"
Const DatabaseName As String = "YourDatabaseName"
Const DocNumToFind = 123456
Const DocVerToFind = 1

    tempDocName = "C:\temp\mydoc.doc"

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

    Set dmsDatabase = dmsSession.Databases.ItemByName(DatabaseName)

    Set doc = dmsDatabase.GetDocument(DocNumToFind, DocVerToFind)
    doc.GetCopy tempDocName, imGetCopyOptions.imNativeFormat
查看更多
登录 后发表回答