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)
Search for WorkSpaces Dialog.
piyush123po
Can anyone tell me how to use Search for WorkSpaces Dialog box?
What parameters i will have to pass andhow to get the results of that search? I need to show those results in a Treeview.
Find more posts tagged with
Comments
Migrateduser
It depends on whether you want to actually display the dialog box, or just search for the WorkSpaces.
To display the dialog box, use the
[left]IManExt2.IManBrowseCmd
[/left]
(see page 78 of the Extension Library Developer's Guide)
This command must be populated with the parameters you want to use in the ContextItems collection, then will erturn a collection of selected objects.
TestReport.rptdesign
piyush123po
Hi,
I am using this code:
Dim WSSD As New IMANEXT2Lib.IManBrowseCmd
Dim cItems As New ContextItems
cItems.Add("ParentWindow", Me.Handle.ToInt32)
cItems.Add("IMANDMS", Global.DMS)
cItems.Add("SelectedNRTSessions", Global.DMS.Sessions)
WSSD.Initialize(cItems)
WSSD.Update()
WSSD.Execute()
but it gives me the error:
Incorrect Parameter .execute.
so can you plz send me some code snippet which shows how to show WorkspaceSearchDialog and how to get the results.
Thanks
Piyush Gupta
Migrateduser
I don't think you can add an IMANDMS - it must be an NRTDMS, and you cannot set the session array to an existing sessions collection, you must populate a "safe array" of NRTSession objects (again, not iManSession objects).
Here is a simple function we use generically:
Public Function GetWorkSiteDestinationFolder(hWnd As Long) As IManFolder
Dim oCmd As IMANEXT2Lib.IManBrowseCmd
Dim oContext As ContextItems
Dim arrSess(0) As NRTSession
Dim arrSelectableItems() As imObjectType
Dim retSelectedItems As Variant
Dim blRefresh
On Error GoTo ErrorMsg
Set arrSess(0) = pSession
' All object types
ReDim arrSelectableItems(0 To 0)
'arrSelectableItems(0) = imObjectType.imTypeDocumentFolder
arrSelectableItems(0) = imObjectType.imTypeWorkSpace ' To only get WorkSpaces
Set oCmd = New IManBrowseCmd
Set oContext = New ContextItems
' Add required values
oContext.Add "NRTDMS", pNRTDMS
oContext.Add "SelectedNRTSessions", arrSess
oContext.Add "ParentWindow", hWnd
oContext.Add "IManExt2.BrowseCmd.SelectableObjectTypes", arrSelectableItems
oCmd.Initialize oContext
oCmd.Update
oCmd.Execute
blRefresh = oContext.Item("IManExt.Refresh")
If blRefresh = True Then
retSelectedItems = oContext.Item("IManExt2.BrowseCmd.SelectedObjects")
If Not IsEmpty(retSelectedItems) Then
Set GetWorkSiteDestinationFolder = retSelectedItems(0)
End If
End If
GoTo CLEANUP
ErrorMsg:
Err.Clear
CLEANUP:
Set oContext = Nothing
Set oCmd = Nothing
End Function
jny
Here's the sample code for invoking the Workspace Search dialog:
[VB]
Option Explicit
Private WithEvents cmd As WorkspaceSearchCmd
Private Sub cmd_OnInitDialog(ByVal pMyInterface As Object)
Dim dlg As WorkspaceSearchDlg
Set dlg = pMyInterface
' Example on prepopulating search values.
dlg.SetAttributeValueByID nrCustom1, "99999", True
End Sub
Private Sub Form_Load()
Dim dms As New ManDMS
Dim sess As IManSession
' Dim cmd As WorkspaceSearchCmd
Dim context As ContextItems
Dim saSess(0) As NRTSession
Set sess = dms.Sessions.Add("SERVER")
sess.Login "USER", "PASSWORD"
Set saSess(0) = sess
Set cmd = New WorkspaceSearchCmd
Set context = New ContextItems
With context
.Add "ParentWindow", Me.hWnd
.Add "IManDMS", dms
.Add "SelectedNRTSessions", saSess
End With
With cmd
.Initialize context
.Update
.Execute
End With
End Sub
piyush123po
Hi All,
This code is perfectly working to open the workspace search dialog and returning the results.
Dim SearchCmd As IMANEXT2Lib.WorkspaceSearchCmd = New IMANEXT2Lib.WorkspaceSearchCmd
Dim ContextItems As IMANEXTLib.ContextItems = New IMANEXTLib.ContextItems
Dim FolderResults As IManage.IManFolders = Nothing
Dim DBResults() As String = Nothing
ContextItems.Add("ParentWindow", Me.Handle)
ContextItems.Add("IManDMS", Global.DMS)
ContextItems.Add("SelectedIManSession", Global.session)
SearchCmd.Initialize(ContextItems)
SearchCmd.Update()
If SearchCmd.Status = (SearchCmd.Status And IMANEXTLib.CommandStatus.nrActiveCommand) Then
SearchCmd.Execute()
FolderResults = ContextItems.Item("SearchedFolders")
DBResults = ContextItems.Item("SearchedDatabases")
End If
ContextItems.Remove("FolderSearchParameters")
ContextItems.Remove("IManExt.Refresh")
ContextItems.Remove("IManSearchParameters")
ContextItems.Remove("SearchedFolders")
ContextItems.Remove("SearchedDatabases")
abc1234
HI piyush,
I ran u r sample code in .net 2.0 as such u gave. When i'm complie the code i'm getting two errors
1 'DMS' is not a member of ''. Error
2 'session' is not a member of ''. Error
These are the two lines causing the error
ContextItems.Add("IManDMS", Global.DMS)
ContextItems.Add("SelectedIManSession", Global.session)
Global.DMS and Global.session is cause for the error
Please let me know the Problem.
Thanks in advance
abc1234
hi piyush u r code with slight modification
Sample code for workspaces Dialog (worked in .net 2.0)
1) Add Reference iManExt2.dll to project
2) working Code :
Dim SearchCmd As IMANEXT2Lib.WorkspaceSearchCmd = New IMANEXT2Lib.WorkspaceSearchCmd
Dim ContextItems As IMANEXTLib.ContextItems = New IMANEXTLib.ContextItems
Dim FolderResults As IManage.IManFolders = Nothing
Dim DBResults() As String = Nothing
Dim dms As New IManage.ManDMS
Dim sess As IManage.IManSession
Dim saSess(0) As IManage.NRTSession
sess = dms.Sessions.Add("ServerName")
sess.Login("userNAme", "Password")
saSess(0) = sess
ContextItems.Add("ParentWindow", Me.Handle)
ContextItems.Add("IManDMS", dms)
ContextItems.Add("SelectedIManSession", sess)
SearchCmd.Initialize(ContextItems)
SearchCmd.Update()
If SearchCmd.Status = (SearchCmd.Status And IMANEXTLib.CommandStatus.nrActiveCommand) Then
SearchCmd.Execute()
FolderResults = ContextItems.Item("SearchedFolders")
DBResults = ContextItems.Item("SearchedDatabases")
End If