Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Showing search result in new window
ItayZohar
Hi
I need to run an execute file which get some parameters (probably CUSTOM2 and CUSTOM2) and then perform a search and show a window with the results. In the windows I need some basic commands like open, print and such other commands.
Is any one having an example like this in the SDK?
Thank you
Itay Zohar
Find more posts tagged with
Comments
ItayZohar
hi
i got manage to do this
if some one is interesting here is the code :
(open the "open dialog" with search result)
Option Explicit On
Module Module1
Sub Main()
Dim MyDialog As IIntegrationDlg.DocOpenDlg
Dim commands(1) As String
Dim lCommandSelected As Long
Dim DocArray As Object
Dim hHandle As Long
Dim pSessions As IManage.NRTSessions
Dim mySession As IManage.NRTSession
Dim pNRTDMS As IManage.NRTDMS
Dim pSession As IManage.NRTSession
Dim sSTR As String = ""
'-----------------------------------------
'Get the argument
sSTR = Command()
'MsgBox(sSTR)
Dim arrString() As String = sSTR.Split(New Char() {" "c})
'MsgBox(arrString(0))
'For Each s As String In arrString
'System.Console.WriteLine(s)
'Next
'Log-In into DMS and hold the session
pNRTDMS = New IManage.NRTDMS
pSessions = pNRTDMS.Sessions
'pSessions is a NRTSessions collection
'First create a new NRTSession object
'Set ServerName$, UserID$, and Password$ appropriately
mySession = pSessions.Add("SERVER-NAME")
'Then use the Login method on the new NRTSession object
mySession.Login("USER-NAME", "PASSWORD") 'Log-In with User and Password
'mySession.TrustedLogin() 'Log-In with Trusted LogIn
'Check if Login was successful
If mySession.Connected = True Then
'MsgBox("Login Successful!")
Else
MsgBox("Login Failed.")
GoTo Cleanup
End If
'Finis Log-In
'parent window handle
'Set hHandle equal to the parent window handle
'If openning from SAP, need to init the handle of SAP here
hHandle = 0 'pHandle
'Create instance of DocOpenDlg object
MyDialog = New IIntegrationDlg.DocOpenDlg
'Set properties on dialog object
MyDialog.NRTDMS = pNRTDMS 'Log_In data
MyDialog.SingleSel = False 'the user can select more then 1 file
MyDialog.CloseOnOK = True 'work the same in False and True
'Define the commands that should appear on the action menu
commands(0) = "
@1@&
;Open"
commands(1) = "
@2@&
;View"
'Set CommandList property on DocOpenDlg object
MyDialog.CommandList = commands
MyDialog.Caption = "Show Search Result" 'Change the title of the dialog
' making the search
Dim SearchParams As IManage.NRTSearchParameters
SearchParams = pNRTDMS.CreateSearchParameters
SearchParams.Clear() 'Clean the search parameters
'SearchParams.Add(IManage.AttributeID.nrAuthor, "admin") 'Set the Author
'SearchParams.Add(IManage.AttributeID.nrClass, "DOC") 'Set the Class
SearchParams.Add(IManage.AttributeID.nrAuthor, arrString(0)) 'Set the Author
SearchParams.Add(IManage.AttributeID.nrClass, arrString(1)) 'Set the Class
'insert the search parameters into the dialog
MyDialog.ShowContainedDocuments = SearchParams 'show the searches
'Display the dialog and pass the parent window
'handle to the Show method
MyDialog.Show(hHandle)
'Determine the action selected by the user
'Value is -1 when Cancel is selected
lCommandSelected = MyDialog.CommandSelected
'Set DocArray equal to the array of NRTDocument
'objects selected by the user
DocArray = MyDialog.DocumentList
'Passing through all the files which selected and run the selected action
Dim doc As IManage.NRTDocument
Dim i, ct As Long
ct = UBound(DocArray) - LBound(DocArray)
'Loop all the files
For i = 0 To ct
doc = DocArray(i)
' "1" represents the action button to OPEN documents
If lCommandSelected = 1 Then 'Open
Dim objOpenCmd As IMANEXTLib.OpenCmd 'IMANEXTLib.ViewCmd
Dim collContext As IMANEXTLib.ContextItems
Dim arrDox(0) As IManage.NRTDocument
objOpenCmd = New IMANEXTLib.OpenCmd 'IMANEXTLib.ViewCmd
collContext = New IMANEXTLib.ContextItems
arrDox(0) = doc
' Set required contextitems
collContext.Add("ParentWindow", 0) 'FrmOD.hWnd) 'Insert here SAP handle
collContext.Add("SelectedNRTDocuments", arrDox)
' Initialize command
objOpenCmd.Initialize(collContext)
' Update command
objOpenCmd.Update()
' Execute if Active
'If objViewCmd.Status = (objViewCmd.Status And nrActiveCommand) Then
If objOpenCmd.Status = (objOpenCmd.Status) Then
objOpenCmd.Execute()
End If
objOpenCmd = Nothing
End If
' "2" represents the action button to VIEW documents
If lCommandSelected = 2 Then 'View
Dim objViewCmd As IMANEXTLib.ViewCmd
Dim collContext As IMANEXTLib.ContextItems
Dim arrDox(0) As IManage.NRTDocument
objViewCmd = New IMANEXTLib.ViewCmd
collContext = New IMANEXTLib.ContextItems
arrDox(0) = doc
' Set required contextitems
collContext.Add("ParentWindow", 0) 'FrmOD.hWnd) 'Insert here SAP handle
collContext.Add("SelectedNRTDocuments", arrDox)
' Initialize command
objViewCmd.Initialize(collContext)
' Update command
objViewCmd.Update()
' Execute if Active
'If objViewCmd.Status = (objViewCmd.Status And nrActiveCommand) Then
If objViewCmd.Status = (objViewCmd.Status) Then
objViewCmd.Execute()
End If
objViewCmd = Nothing
End If
Next i
'Clean up
Cleanup:
' Free pointers before exiting
MyDialog = Nothing
doc = Nothing
End Sub
End Module