Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Show users

  Asked By: Ganesh    Date: Aug 08    Category: Sharepoint    Views: 826

I've asked for this before but I hav not got any help so I try again.
It would be of great help if I could run a script or webpart that show me
all userid's and their rights on the <workspace> and <documents/subfolders>.

<workspace settings>
Workspace User/group Role
myworkspace 12345 Author
myworkspace 23456 Coordinator

Workspace User/group Role
myworkspace 12345 Author
myworkspace 23456 Coordinator

Workspace Subfolder User/group Role
myworkspace subfolder1 12345 Author
myworkspace subfolder1 23456 Reader
myworkspace subfolder2 23456 Author
and so on.......

Does anybody know where I can get my hands on such a script or webpart you would
make my day a good one.



5 Answers Found

Answer #1    Answered By: Sydney Lewis     Answered On: Aug 08

I stitched a couple of scripts together for you. It's not the same output you
listed below but can be modified and will produce this:

AUTHORS of http://server/workspace/Documents/Folder1
COORDINATORS of http://server/workspace/Documents/Folder2

Here's the code:

' ListAuthors.vbs
' List all authors and permissions for a location
' Bil Simser 09/09/2003 v1.0 Based on code by Andy Ball

Set objPKMWrk = CreateObject("CDO.KnowledgeWorkspace")
Dim objPKMWrk ' CDO.KnowledgeWorkspace
Dim objRS ' ADODB.RecordSet

' get the args
Set WshShell = Wscript.CreateObject("Wscript.Shell")
set oArgs=Wscript.Arguments

' get Servername passed in otherwise use local machine
if oArgs.Count <> 1 Then
Wscript.Echo "Usage : CSCRIPT listfiles.vbs http://server/workspace/Documents"
kWorkspaceURL = oArgs.Item(0)
End If

' Connect to a workspace  in read only mode.
objPKMWrk.DataSource.Open kWorkspaceURL, , adModeRead

' Get the folders inside the workspace.
Set objRS = objPKMWrk.Subfolders

' Call sub to enumerate subfolders of workspace.
EnumRS objRS

' EnumRS(objRS)
' objRS is a ADO RecordSet containing the subfolders within a folder or
' usually obtained from the .SubFolders property off a KnowledgeFolder or
' KnowledgeWorkspace object.
' Walks thru a recordset until EOF and then calls itself to enumerate any object
' which contains more folders.
Sub EnumRS(objRS)

Dim objPKMFld ' CDO.KnowledgeFolder
Dim objTmpRS ' ADODB.RecordSet
Dim objFolder
Dim User
Dim ArrayItemCount

' Loop until end of RecordSet
Do While objRS.EOF <> True

ShowFolderPermissionsAll objRS("DAV:href")

' If the folder contains subfolders then enumerate them too
If CBool(objRS("DAV:iscollection")) Then
' Create a CDO.KnowledgeFolder object and point it to
' the folder in read only mode.
Set objPKMFld = CreateObject("CDO.KnowledgeFolder")
objPKMFld.DataSource.Open objRS("DAV:href"), , adModeRead

' Get the folders inside the folder.
Set objTmpRS = objPKMFld.Subfolders

' Recursively call sub to enumerate folders within folders.
EnumRS objTmpRS
End If

' Move to next record within RecordSet


End Sub

' Sub ShowFolderPermission
' Shows permissions on the relevant folder
Sub ShowFolderPermissions (FolderPath, Permission)
Dim arPermissions ' Array to store current permissions
Dim oFolder ' folder object
Dim User ' item used in FOR EACH in array
Dim ArrayItemCount

' Create object
set oFolder = CreateObject("CDO.KnowledgeFolder")

' Open the folder
oFolder.DataSource.Open FolderPath

' Return the relevant array depending on the type of user
Select Case UCASE(Permission)
Case "READER" arPermissions = oFolder.Readers
Case "COORDINATOR" arPermissions = oFolder.CoOrdinators
Case "AUTHOR" arPermissions = oFolder.Authors
' trap dodgy permission. Would be cool if could retrive valid permissions as
this is likely to change between versions
Case Else WScript.Echo Permission & " is not valid. Should be READER, AUTHOR
or Coordinator"
Exit Sub
End Select

' Get the number of items in the array
ArrayItemCount = UBound(arPermissions) + 1

' ie if no (say) readers print message
if ArrayItemCount = 0 Then
WScript.Echo "No " & Permission & " Permissions on " & FolderPath
' Otherwise roll through printing permissions
Wscript.Echo Permission & "S of " & FolderPath
For Each User in arPermissions
Wscript.Echo vbTAB & User
End If
set oFolder = Nothing
End Sub

' Show all permissions
' Procedure ShowFolderPermissionsAll
Sub ShowFolderPermissionsAll(FolderPath)

ShowFolderPermissions FolderPath, "READER"
ShowFolderPermissions FolderPath, "AUTHOR"
ShowFolderPermissions FolderPath, "COORDINATOR"

End Sub

Answer #2    Answered By: Jayme Raymond     Answered On: Aug 08

I tried to run  the script  you wrote in your mail but I get this errormessage.
"D:\Tools\Listfiles.vbs(24, 1) : [DBSTATUS_E_DOESNOTEXIST] Cannot find specified
column. *** $$$ TBD"

Answer #3    Answered By: Devika Bellad     Answered On: Aug 08

Sorry. The list messed up the formatting of the script. The line that
' Connect to a workspace  in read only mode. objPKMWrk.DataSource.Open
kWorkspaceURL, , adModeRead

Should be split so it reads:
' Connect to a workspace in read only mode.
objPKMWrk.DataSource.Open kWorkspaceURL, , adModeRead

This will create the workspace object and open it so the error you're
getting will be resolved.

Answer #4    Answered By: Diego Paul     Answered On: Aug 08

I'm having some problems running this script.

Although it does run, it displays no reader/author/coordinator on each folder in
the workspace, eventhough these settings are in place on each folder. Is there
something I'm doing wrong?

Answer #5    Answered By: Denis Cantrell     Answered On: Aug 08

Nevermind, I was running the script  from the wrong location...!

Didn't find what you were looking for? Find more on Show users Or get search suggestion and latest updates.