I have an external application which displays all sub-sites and document libraries where the user has write permissions. At the moment I am using "GetRolesAndPermissionsForCurrentUser" to get permissions for each sub-site and "GetListItemChangesSinceToken" to get permissions for each library.

But this is a very time taking process as, if there are 100 sub-sites I need to make a web-service call for each sub-site .i.e., 100 calls. Is there any way to get all the sub-sites and document libraries where the user has Write permission? Or at least any way that I can piggyback all the web-service requests for all the sub-sites in one call.


EDIT Just realised you are performing this task using Web services. Back to the drawing board (I don't have access to delete the post)!

I'm not really a developer but this is a fairly common scenario and it sparked my interest. I imagine there is a better way of doing it but this may work:

You could construct a CAML query using the SPSiteDataQuery class to retrieve all lists in the site collection.

To view permissions you could specify the "IncludeAllUserPermissions" property in a where clause that defines the SPSiteDataQuery.Query property.

SPSiteDataQuery returns a DataTable object that should contain the lists and permissions assuming the above is correct.

If I get a chance I may give this a try on a test VM, but let me know how you get on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.