Home
TeamSite
Imanage COM and VBScript
wwest
I am attempting to use the COM interface for Imanage WorkSite (I have the Docs and SDK). I cannot seem to get beyond the adding of a new session. Are there any examples of doing a simple login and/or using getcopy to retrieve a copy of a document using VBScript?
Here is what I have:
'Example.....(vbscript)
dim objNRTDMS
dim objSessions, objSession
dim objDocument
set objNRTDMS = createObject("IManage.NRTDMS")
msgbox objNRTDMS.Sessions.Count 'shows 0
set session = objNRTDMS.Sessions.Add("FOO")
msgbox objNRTDMS.Sessions.Count 'shows 1
''''''''Cannot reference session object without getting "Library not Registered" error:
msgbox "session.Databases.Count: " & session.Databases.Count
session("FOO").TrustedLogin
msgbox session.Connected
Find more posts tagged with
Comments
STodd
wwest,
You need to perform a login on the session object - either using
Set objSession = objNRTDMS.Sessions(1)
objSession.TrustedLogin
or
objSession.Login(username, password)
Once you've done this, you should be ok.
If you're using the NRS scripts, e.g. NewProf.nrs, you don't need to do this - use the Context object instead, which will exist when the NRS file is fired. This is an NRTDMS object, with sessions from your Registered Servers that are logged in already.
Steve
wwest
I tried as you said, but I still get the same error. I can use the COM interface successfully in VB 6.0 without any problem. It's almost like vbscript can't see the namespace for the COM object. This is what I tried last:
dim objNRTDMS
dim objSession
set objNRTDMS = createObject("IManage.NRTDMS")
msgbox objNRTDMS.Sessions.Count 'shows 0
set objSession = objNRTDMS.Sessions.Add("ACFLE")
set objSession = objNRTDMS.Sessions(1)
msgbox objNRTDMS.Sessions.Count 'shows 1
'Cannot reference session object without getting "Library not Registered" error:
objSession.TrustedLogin
Thanks,
-Wilson
STodd
In which case, it may be a problem with the WorkSite object model (there are one or two...LOL)
Have you tried wrapping your code in a DLL, and calling it from the VBScript? That way, you can use code you know is correct, and call it directly outside the VBScript environment. If it is required for the web, it should be easy to create a web CAB file that includes the DLL.
Steve.
jny
The error you have encountered appears to indicate that the iManage.dll is not registered. I tested in my test.vbs which has the code below and it connected successfully (after I registered the iManage.dll).
test.vbs code
++++++++++++++++++++++++++++++++++++++++++++
dim objNRTDMS
dim objSession
set objNRTDMS = createObject("IManage.NRTDMS")
set objSession = objNRTDMS.Sessions.Add("myserver")
objSession.TrustedLogin
msgbox objSession.Connected
++++++++++++++++++++++++++++++++++++++++++++
jny
which version of the iManage.dll do you have? there was a bug in v7.0.1.33 which was shipped with DeskSite 6.0.1a that had this Library Not Registered problem. This was a declarative problem; it came from the IDispatchImpl referring to the wrong type library (the original imanage.dll library).
Versions 7.0.1.52 and forwards should have the fix for this problem. This implies updating DeskSite/FileSite with the latest hotfix or the SP1.