Using the SDK for a Web Service, I have been able to add a user to a WorkSpace and grant them access, however the WorkSpace isn't refiled and so they effectively have access to only the root folder and nothing else.
I know there is the Refile()
method, I am just not sure how to perform a refile of folders and documents within the WorkSpace.
Currently I have a function which grants a user access to the WorkSpace, I have tested and this function works, the following is part of the function, before this code I have initiated WorkSpace search methods and the code below is iterating through the search results.
Dim retString As String = ""
For Each w As IManWorkspace In oDB.SearchWorkspaces(oparams, oWparams)
' Get the WorkSpace security container
Dim oSec As IManSecurity = w.Security
Dim oUACLs As IManUserACLs = oSec.UserACLs
' Grant the user the defined access
oUACLs.Add(sUserID, imAccessRight.imRightReadWrite)
' Apply the changes
w.Update()
' Refresh the Collection on the client
oUACLs.Refresh()
' TO DO: REFILE THE SUB-FOLDERS AND DOCUMENTS
retString = oUACLs.Contains(sUserID).ToString()
Next
Return retString(at the moment I have hard-coded the defined access for the user to the WorkSpace, this will be changed to a dynamic value before going live).
As I already have the WorkSpace object, the
COM Developers Reference Guide (pg 244)
says I need to get an IManProfiledFolder object and then get the profile belonging to the profiled folder object:
Code:
Dim objProfFldr as IManProfiledFolder = w
w being an IManWorkSpace in my above code
Dim objProf as IManProfile = objProfFldr.Profile
I can then get the WorkSpace security object via:
Dim oSecurity AS IManSecurity = w.SecurityAnd
putting this together, I guess this makes the complete Refile()
method be called as Refile(objProf, oSecurity)
.
I am just not clear on how I apply this all to the WorkSpace, do I need to iterate through all sub-folders and apply the Refile() method to each document, or can I issue a method at the WorkSpace level that will do the iteration for me?