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)
Retrieving Folders
mjcolli
Hello there. I am trying to retrieve a list of all folders a user has access too so they can select that folder and upload documents. I've got the doc upload part working fine, but I have to hard code the folder ID in each time. I've gone through all sorts of attempts, and really haven't gotten too close at all. Any direction would be helpful. This is my latest attempt, and it fails miserably...
Dim iuser As Integer = InStr(WindowsIdentity.GetCurrent().Name, "\") + 1
Dim sUser As String = Mid(WindowsIdentity.GetCurrent().Name, iuser)
Dim iwDatabases As IManDatabases
Dim iwDatabase As IManDatabase
Dim iwDMS As IManDMS
Dim iwSession As IManSession
Try
' Log in to Interwoven and begin the IW Session
iwDMS = New ManDMSClass()
iwSession =
iwDMS.Sessions.Add(ConfigurationManager.AppSettings("IW_session"))
iwSession.TrustedLogin()
iwDatabases = iwSession.Databases
iwDatabase = iwDatabases.ItemByName("ADMIN")
Dim loUser As IManUser
loUser = iwDatabase.GetUser(sUser.ToUpper)
Dim objFolderSearchParams As IManFolderSearchParameters
Dim objFolderSearchParam As IManFolderSearchParameter
Dim usersFolders As IManFolders
objFolderSearchParams = iwDMS.CreateFolderSearchParameters
objFolderSearchParams.Add(imFolderAttributeID.imFolderOwner, _
sUser.ToUpper)
usersFolders = iwSession.WorkArea.SearchFolders(iwDatabase, _
objFolderSearchParams)
Dim interwovenFolders As New ArrayList()
For Each currFolder As IManFolder In usersFolders
interwovenFolders.Add(New InterwovenFolder(currFolder.Name, _
currFolder.FolderID))
Next
' bind to listbox...
lstInterwovenFolders.DataSource = interwovenFolders
lstInterwovenFolders.DisplayMember = "iwFolderName"
lstInterwovenFolders.ValueMember = "iwFolderID"
-MJC
Find more posts tagged with
Comments
mjcolli
For anyone interested, this is what I ended up using....
Dim iwDMS As ManDMS
iwDMS = New ManDMS
Dim iwSession As IManSession
iwSession = _
iwDMS.Sessions.Add(MYSESSION)
iwSession.TrustedLogin()
Dim iwDB As IManDatabase
iwDB = iwSession.Databases.ItemByName("MYDBNAME")
Dim dblist As ManStrings
dblist = New ManStrings
dblist.Add(iwDB.Name)
Dim iwFSParams As IManFolderSearchParameters
iwFSParams = iwDMS.CreateFolderSearchParameters()
iwFSParams.Add(imFolderAttributeID.imFolderOwner, sUser.ToUpper)
Dim userFolders As IManFolders
userFolders = iwSession.WorkArea.SearchFolders(dblist, iwFSParams)
Dim currFolder As IManFolder
Dim slFolders As New SortedList
For ii As Integer = 1 To userFolders.Count - 1
currFolder = userFolders.ItemByIndex(ii)
slFolders.Add(currFolder.FolderID, currFolder.Name)
Next
lstInterwovenFolders.DisplayMember = "value"
lstInterwovenFolders.ValueMember = "key"
Dim entry As DictionaryEntry
For Each entry In slFolders
lstInterwovenFolders.Items.Add(entry)
Next
lstInterwovenFolders.Sorted = True
mjcolli
Still don't know how to retrieve a list of all folders a user has access to. The above only gets me folders the user is an owner of.
-MJC
Arwin
You have to ask yourself an important question here. If the user should be able to select from all folders that he has access to, that means that you are basically consulting the security model, and want to query the security table for all objects that a user has access to and that are folders.
A query like this is, as far as I know, not possible using the API. But should it be? Normally you can just access the API in this user's context, and then if you search for any folder, the API will automatically determine what folders the user has access to and what folders he doesn't.
To take that a step further, you could (and normally should) simply use the Browse control. You can filter the Browse control so that it only allows the user to select a folder, provide it with a custom title, and so on. And again, when used in the context of this user, the Browse control will already automatically filter the folders the user has access to, as well as provide links to the my workspaces, favorites, and so on.
So what are you trying to achieve?
mjcolli
I was able to achieve what I wanted with a direct SQL query, filtering out public folders, and including folders with inherited security. See attachment for end result. It loads in less than a second.
To answer your question, yes, I do believe the API should have a method to allow this. A simple getFolders([user]) method would be nice. I was tasked with giving this application the ability to select a user accessible folder from a simple list (not a tree structure). Documents will then be uploaded to the folder, with specific security applied. The browse control seemed like overkill to me. I was going for maximum simplicity. That being said, had I not figured out an alternative solution, I was going to use that.
Thanks for your reply....
-MJC