Bringing up Search Docs (Extension Library)

Options
I am having trouble with the basic task of displaying the Search Documents form using VB.Net. I keep getting a Status = 1 after pLoginCmd.Update.

I suspect it is to do with the 'Safe Array of one NRTSession' added to the Context Items. I have tried a few variations, but cannot get it to appear.

I have a simple test project. The code is as follows. I have references to all the iManExt*.dlls. The LoginCmd appears and logs me on as WSADMIN (trusted login) with no issues.

What am I missing?


'CLASS Level objects
Dim pNRTDMS As New IManage.NRTDMS
Dim pNRTSessions As IManage.NRTSessions
Dim pNRTSession1 As IManage.NRTSession
Dim hWnd As Long


Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

' LOGIN: via prompted login window

Dim bRefresh As Boolean
Dim pLoginCmd As IMANEXTLib.LoginCmd
Dim pContextItems As IMANEXTLib.ContextItems

'hWnd is the parent window handle (Long - class variable)
hWnd = Me.Handle

'Create a new ContextItems collection
pContextItems = New IMANEXTLib.ContextItems

'Optional parameter: server names
Dim pVarSessArray(0 To 0) As String
pVarSessArray(0) = "WORKSITE85"

'Populate the ContextItems collection with values
pContextItems.Add("NRTDMS", pNRTDMS)
pContextItems.Add("NRTSessions", pNRTSessions)
pContextItems.Add("ParentWindow", hWnd)
pContextItems.Add("SelectedNRTSessionNames", pVarSessArray)

pLoginCmd = New IMANEXTLib.LoginCmd

'Initialize the LoginCmd by pointing it to the proper ContextItems collection
pLoginCmd.Initialize(pContextItems)

'Use the Update method to find out if the command is available.
pLoginCmd.Update()

'If the command is active, it can be executed.
If pLoginCmd.Status = IMANEXTLib.CommandStatus.nrActiveCommand Then
pLoginCmd.Execute()

'Get return value
bRefresh = pContextItems.Item("IManExt.Refresh")
If bRefresh = True Then

'Define First Session: pNRTSession1
pNRTSession1 = pNRTSessions.Item(1)

End If

'When finished using context items, remove them from the collection
pContextItems.Remove("IManExt.Refresh")

End If
End Sub



Private Sub btnSearchDocs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchDocs.Click

'Open Doc Search Window - Fails

Dim pSrchParams As IManage.NRTSearchParameters
'Extension Library Demo has this as Variant. VB.Net Auto-corrects to Object
Dim pNRTDBs As Object

Dim Overflow As String
Dim pSearchCmd As IMANEXTLib.SearchCmd
Dim pContextItems As IMANEXTLib.ContextItems
Dim pNRTDocs As IManage.NRTDocuments
'pNRTDMS is the NRTDMS object
'hWnd is the parent window handle
hWnd = Me.Handle

'pNRTSessionArray is a SAFE Array of one NRTSession object
Dim pNRTSessionArrayObj(0 To 0) As Object
pNRTSessionArrayObj(0) = pNRTSession1

' Create a new ContextItems collection
pContextItems = New IMANEXTLib.ContextItems

' Populate the ContextItems collection with required values
pContextItems.Add("ParentWindow", hWnd)
pContextItems.Add("NRTDMS", pNRTDMS)
pContextItems.Add("SelectedNRTSessions", pNRTSessionArrayObj)

' Create a new ImportCmd object
pSearchCmd = New IMANEXTLib.SearchCmd

' Initialize the ImportCmd to point it to the proper ContextItems collection
pSearchCmd.Initialize(pContextItems)

' Use the Update method to check if command is available
pSearchCmd.Update()

' If command is active, then it can be executed
If pSearchCmd.Status = IMANEXTLib.CommandStatus.nrActiveCommand Then 'Status = 1, so jumps to ELSE
pSearchCmd.Execute()

pNRTDocs = pContextItems.Item("SearchedNRTDocuments")
pSrchParams = pContextItems.Item("SearchParameters")
pNRTDBs = pContextItems.Item("SearchedDatabases")
Overflow = pContextItems.Item("varOverFlow")

MsgBox("pSearchCmd.Status: " & pSearchCmd.Status.ToString)

pContextItems.Remove("ParentWindow")
pContextItems.Remove("NRTDMS")
pContextItems.Remove("NRTSessions")

Else
MsgBox("pSearchCmd.Status: " & pSearchCmd.Status.ToString)
End If
'Tidy Up

End Sub

RobCom
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs