Home
TeamSite
How to set initial folder in folder browser
Ben_inform
Hi,
I am working on some critical developments for a big WorkSite 8.0 deal for a large Law firm in Australia and would like some assistance on a specific issue that I need to resolve.
I have written some code to display the iManage folder browser when a custom lookup button is pressed from the DeskSite new profile dialog.
When I display the folder browser - how can I set the 'initially selected folder' to a given folder. i.e. if I know I have a folder called 'xyz', when I display the folder browser , how do I make it selected? I could do this in worksite 7.5 by using the objDialog.SelectedFolder = Folder2 where Folder2 is a IManage.NRTFolder object.
This doesn't seem to work with worksite 8.0 (I have the beta). See the code below which worked for worksite 7.5 / desksite 6.1 but doen't for worksite 8.
'------------------------------------- CODE -------------------------------------
Dim objVar As Object
Dim objSessions(0 To 1) As Object
Dim pWindow As Long
Dim SelectedPath As String
Dim contextItems As IMANEXTLib.IContextItems
Dim ParentAlias As String
Set objDialog = New IIntegrationDlg.BrowseFoldersDlg
Set contextItems = ICommand_Context
Set mydb = contextItems("IManExt.SelectionDlg.Object")
BrowseFolder = False
' Ben Added this 21/12/2003 to initialise the folder dlg to the selected folder
' which is passed in through IManExt.SelectionDlg.ParentAlias
ParentAlias = contextItems("IManExt.SelectionDlg.ParentAlias")
Dim RootFolder As IManage.NRTFolder
Dim AllFolders As IManage.NRTFolders
Dim AllFolders2 As IManage.NRTFolders
Dim Folder As IManage.NRTFolder
Dim Folder2 As IManage.NRTFolder
Dim Message As String
Dim folderalias As String
Dim bFound As Boolean
bFound = False
'nrDatabase is a currently available database
Set RootFolder = mydb.Root
Set AllFolders = RootFolder.Folders
For Each Folder In AllFolders
If Folder.Name = "KM" Then ' only search in folders below the "KM" folder
Set AllFolders2 = Folder.Folders
For Each Folder2 In AllFolders2
folderalias = Replace(UCase(Folder2.Name), " ", "")
If ParentAlias = folderalias Then
'MsgBox "Department Found: " + folderalias
objDialog.SelectedFolder = Folder2
bFound = True
Exit For
End If
If bFound Then
Exit For
End If
Next
End If
Next Folder
' end of Bens code
objDialog.NRTDMS = mydb.Session.NRTDMS
objDialog.SelectedDatabase = mydb
objDialog.ShowSingleDatabase = True
objDialog.ShowReadWriteFoldersOnly = True
objDialog.Show pWindow
'------------------------------------- CODE -------------------------------------
Find more posts tagged with
Comments
jny
This is legacy code in the 8.0 architecture. To implement this Intewoven object, you may instead use the new interface, IMANEXT2LIB.IManBrowseCmd. This is due to code re-vamp for fitting into the new matter-centric design and architecture.
It sounds like you're using your custom lookup to pre-select a folder that is entered by the user on the corresponding field (to your lookup). If so, in the 8.0 new profile dialog, there is already a location field that you can pre-set the folder location (by entering the folder name).
hope this help.
Ben_inform
Hi,
Do you have any examples of using the IMANEXTLib2.ManBrowseDlg method ?
I can't find any and its a headache trying to work out what all the required props are from 10000000 pages of manuals.
Thanks,
Ben.
Weiqun
Hi Ben,
Here is a sample on how to use the new browse dialog. However, there is no easier way to initialize the default selected folder through the new IManBrowseDlg, but the browse dialog do try to remember the last working location through the registry key: "HKCU\Software\Interwoven\WorkSite\8.0\iManExt\BrowseDlg\Last Location", which need a path constructed by a set of monikers. A document folder in 8.x, different from previous version of the product, could be located in multiple locations at the same time, e.g. "My Matters", "My Favorites", etc. To actually locate this folder could be very complicated. At this time, we do like to submit your issue as an enhancement request if this is OK with you.
Dim spDMS As New IManage.ManDMS
Dim spSession As IManage.IManSession
Dim spSessions As IManage.IManSessions
Set spSessions = spDMS.Sessions
Set spSession = spSessions.Add("Server Name")
spSession.Login "user id", "password"
Dim spBrowseCmd As New IMANEXT2Lib.IManBrowseCmd
Dim spContextItems As New IMANEXTLib.ContextItems
'Add the login session to the array
Dim saSess(0 To 0) As Object
Set saSess(0) = spSession
'Add the types of objects allow to be selected in the browse dialog
Dim saType(0 To 2) As IManage.imObjectType
saType(0) = imTypeDocumentSearchFolder
saType(1) = imTypeDocumentFolder
saType(2) = imTypeWorkspace
...
spContextItems.Add "SelectedNRTSessions", saSess
spContextItems.Add "IManExt2.BrowseCmd.SelectableObjectTypes", saType
spBrowseCmd.Initialize spContextItems
spBrowseCmd.Execute
Thanks,
- Weiqun
Ben_inform
Hi thanks for that - it worked a treat.
Is there a way to get the old folder browser working using the old folderbrowser object?
What I want to do is clasify a document based on 4 levels (child dependant on parent) of classification. In the past we have used the folder browser in combination with a custom lookup to attach a folder path as a custom field to a document. The folder path then represents classifying the document to 4 levels.
The new folder browser contains way too much clutter for the folder selection and so i'd like to use a very simple folder browser like in 7.x. Is this possible? I tried the old folderbrowser cmd and it failed to display.
Is there another approach where I can classify a doc using multiple lookups that depend on each other ? i.e. like the current parent-child fields but to 4 levels.
The implementation is a conversion from PCDocs where they currently have 4 drop-downs and they are all related. So the parent selection determines what can be seen in the child etc etc down to 4 levels.
Our approach under 7.5 uses a folder structure to represent the 4 dependant levels. Once a level is selected we match that up with a corresponding custom field.
Do you have any thoughts on this?
Another approach is to just use the out-of-the-box document location selector in WS8 and use that location as the classification.
Its not very good tho because when you classify to a folder it only shows you the current folder and not the full path. and the folderbrowser in WS8 contains all the matter centric navigation objects which would confuse the user.
My ideal solution would be to use a folder structure to classify but be able to display on the profile the path of the folder (i.e. its classification). and also use a simplistic folder browser with a ristricted domain of the classification tree.
I would also need to be able to search for documents based on the classification.
Thanks for any thoughts you have
sorry to write so much!!
Weiqun
You are trying to solve a very interesting problem. Unfortunately, BrowseFolder in the iIntegrationDlg.dll is not available today in the 8.0 release, but we are planning to provide it in the future, since multiple customers would like to use this simple dialog for the similar purpose like what you are trying to achieve. However, this will not meet you immediate needs. So I'm thinking may be you could try to use Search Folders capabilities provided in 8.0. which will return one or more folders which match the search criteria. There is any command in 8.0, which I was not sure if you already know about it, that is the FolderPathCmd in iManExt2.dll, and we call it where used internally. This command will display all of the folders which contains a specific document's reference, but it might not be what you wanted.
Thanks,
Weiqun