Discussion:
WSS 3.0 Web Services - How to retrieve folder permissions?
(too old to reply)
Jarrod
2008-07-28 05:06:43 UTC
Permalink
With the Dws Web Service, you are able to retrieve doc-level permissions via
the Dws.GetDwsMetaData method.
With the Permissions Web Service, you are able to retrieve site and list
permissions via the Permissions.GetPermissionCollection method.

However, there doesn't seem to be any suitable Web Service for retrieving
permissions of a doc folder? Or am I missing something?

Any help/pointers will be most appreciated! Thanks.
Jarrod
2008-07-29 07:38:01 UTC
Permalink
Is there really no way to retrieve folder permissions via WSS 3.0 web services?
Jogy
2008-08-27 18:57:00 UTC
Permalink
Hello,

recently I had similar problem - I had to query user permissions on all
folders and documents in a document library.


After long search, I found one web service method: SiteData.GetContent()
It is not very much documented, and had no examples, but after some
experimenting with the parameters, I get it to return data, which looks like
this:

<Folder>
<xml ...
...
<scopes>
<scope id='{d5475b4a-e74d-47df-87f9-00fd871a1fe5}' >
<permission memberid='1' mask='9223372036854775807' />
<permission memberid='2' mask='9223372036854775807' />
.....
</scopes>

<rs:data ItemCount="19">
<z:row ows_ID='12' ....
ows_ScopeId='12;#{D5475B4A-E74D-47DF-87F9-00FD871A1FE5}'
ows_FileRef='12;#ab1/archive.zip' ows_DocIcon='zip' ....


Basically, it returns a list of 'permission' scopes and then a list of all
documents and folders contained in the library, and for each item there is
the 'permission' scope id, which contains the effective permissions for the
item.


To get this information, i call SiteData.GetContent()
with the following parameters:

string temp = "";
string contentResult = sd.GetContent(SiteData.ObjectType.Folder,
listID, "", "", true, true, ref temp);

where listID is the document library GUID, previously retrieved by a call to
Lists.GetList(document library name)


Hope this helps,

Jogy
Post by Jarrod
With the Dws Web Service, you are able to retrieve doc-level permissions via
the Dws.GetDwsMetaData method.
With the Permissions Web Service, you are able to retrieve site and list
permissions via the Permissions.GetPermissionCollection method.
However, there doesn't seem to be any suitable Web Service for retrieving
permissions of a doc folder? Or am I missing something?
Any help/pointers will be most appreciated! Thanks.
Jarrod
2008-11-11 04:33:00 UTC
Permalink
Thanks Jogy,

It must have been quite a substantial amount of trial and error to stumble
upon this, kudos to you...

Now next question, how do we interprete the mask values?

Btw, is there any official word on this technique? Documentation on
GetContent is sorely lacking, perhaps there's a cleaner and easier way to
retrieve folder permissions?
Jogy
2008-11-11 11:40:01 UTC
Permalink
Post by Jarrod
Thanks Jogy,
It must have been quite a substantial amount of trial and error to stumble
upon this, kudos to you...
Now next question, how do we interprete the mask values?
Hello,

I think the values are same as the ones defined in SPBasePermissions
enumeration of the SharePoint SDK:


[Flags]
public enum SPBasePermissions
{
// Summary:
// Has no permissions on the Web site. Not available through the
user interface.
EmptyMask = 0,
//
// Summary:
// View items in lists, documents in document libraries, and
view Web discussion
// comments.
ViewListItems = 1,
//
// Summary:
// Add items to lists, add documents to document libraries, and
add Web discussion
// comments.
AddListItems = 2,
//
// Summary:
// Edit items in lists, edit documents in document libraries,
edit Web discussion
// comments in documents, and customize Web Part Pages in
document libraries.
EditListItems = 4,
//
// Summary:
// Delete items from a list, documents from a document library,
and Web discussion
// comments in documents.
DeleteListItems = 8,
//
// Summary:
// Approve a minor version of a list item or document.
ApproveItems = 16,
//
// Summary:
// View the source of documents with server-side file handlers.
OpenItems = 32,
//
// Summary:
// View past versions of a list item or document.
ViewVersions = 64,
//
// Summary:
// Delete past versions of a list item or document.
DeleteVersions = 128,
//
// Summary:
// Discard or check in a document which is checked out to
another user.
CancelCheckout = 256,
//
// Summary:
// Create, change, and delete personal views of lists.
ManagePersonalViews = 512,
//
// Summary:
// Create and delete lists, add or remove columns in a list, and
add or remove
// public views of a list.
ManageLists = 2048,
//
// Summary:
// View forms, views, and application pages, and enumerate
lists.
ViewFormPages = 4096,
//
// Summary:
// Allow users to open a Web site, list, or folder to access
items inside that
// container.
Open = 65536,
//
// Summary:
// View pages in a Web site.
ViewPages = 131072,
//
// Summary:
// Add, change, or delete HTML pages or Web Part Pages, and edit
the Web site
// using a Windows SharePoint Services–compatible editor.
AddAndCustomizePages = 262144,
//
// Summary:
// Apply a theme or borders to the entire Web site.
ApplyThemeAndBorder = 524288,
//
// Summary:
// Apply a style sheet (.css file) to the Web site.
ApplyStyleSheets = 1048576,
//
// Summary:
// View reports on Web site usage.
ViewUsageData = 2097152,
//
// Summary:
// Create a Web site using Self-Service Site Creation.
CreateSSCSite = 4194304,
//
// Summary:
// Create subsites such as team sites, Meeting Workspace sites,
and Document
// Workspace sites.
ManageSubwebs = 8388608,
//
// Summary:
// Create a group of users that can be used anywhere within the
site collection.
CreateGroups = 16777216,
//
// Summary:
// Create and change permission levels on the Web site and
assign permissions
// to users and groups.
ManagePermissions = 33554432,
//
// Summary:
// Enumerate files and folders in a Web site using Microsoft
Office SharePoint
// Designer 2007 and WebDAV interfaces.
BrowseDirectories = 67108864,
//
// Summary:
// View information about users of the Web site.
BrowseUserInfo = 134217728,
//
// Summary:
// Add or remove personal Web Parts on a Web Part Page.
AddDelPrivateWebParts = 268435456,
//
// Summary:
// Update Web Parts to display personalized information.
UpdatePersonalWebParts = 536870912,
//
// Summary:
// Grant the ability to perform all administration tasks for the
Web site as
// well as manage content. Activate, deactivate, or edit
properties of Web site
// scoped Features through the object model or through the user
interface (UI).
// When granted on the root Web site of a site collection,
activate, deactivate,
// or edit properties of site collection scoped Features through
the object
// model. To browse to the Site Collection Features page and
activate or deactivate
// site collection scoped Features through the UI, you must be a
site collection
// administrator.
ManageWeb = 1073741824,
//
// Summary:
// Use features that launch client applications; otherwise,
users must work
// on documents locally and upload changes.
UseClientIntegration = 68719476736,
//
// Summary:
// Use SOAP, WebDAV, or Microsoft Office SharePoint Designer
2007 interfaces
// to access the Web site.
UseRemoteAPIs = 137438953472,
//
// Summary:
// Manage alerts for all users of the Web site.
ManageAlerts = 274877906944,
//
// Summary:
// Create e-mail alerts.
CreateAlerts = 549755813888,
//
// Summary:
// Allows a user to change his or her user information, such as
adding a picture.
EditMyUserInfo = 1099511627776,
//
// Summary:
// Enumerate permissions on the Web site, list, folder,
document, or list item.
EnumeratePermissions = 4611686018427387904,
//
// Summary:
// Has all permissions on the Web site. Not available through
the user interface.
FullMask = 9223372036854775807,
}
Post by Jarrod
Btw, is there any official word on this technique? Documentation on
GetContent is sorely lacking, perhaps there's a cleaner and easier way to
retrieve folder permissions?
No official information, the documentation at
http://msdn.microsoft.com/en-us/library/ms772581.aspx
still states only that
"GetContent operation is polymorphic; it can be used (when called with
proper parameters) instead of specific traversal operations - GetSite,
GetWeb, EnumerateFolder, GetListCollection, GetList, GetListItems,
GetAttachments. GetContent fully covers specific traversal operations
functionality, albeit details of input parameters and syntax of the response
might differ."
Jarrod
2008-11-11 14:55:00 UTC
Permalink
Yeap, saw that doc from msdn too - wonder if there's anyone here from the MS
SharePoint team that can shed some light on the various "proper parameters"
to achieve useful results.

Meanwhile, thanks for the pointer on the permission masks.

With regards to the suggested GetContent method, it doesn't quite work out
as expected for me. It only retrieves info from immediate child folders -
i.e. it does not recurse down to deeper subfolders. Also, lastItemIdOnPage
returned is "", so I believe it's not a matter of making additional calls to
retrieve additional pages of info.

Loading...