I have a challenge. On our SharePoint environment, we want to have one page, with all sites where the current user has contribute permissions on. This way, he knows where he can collaborate.

I already found a kind of way to do it with web services on following site http://sympmarc.com/2010/01/29/determining-if-a-user-is-in-a-permission-group-with-sharepoints-web-services/ but I should find a way to do this for all sites in my site collection/farm.

What should be the best approach to do this you guys think?

UPDATE: based on the comments I want to let you know it's an on-premise environment. And it should be great to have a solution that shows all sites of all site collections in the web application. Even it's on-premise, a webservice/spservices solution instead of c# would be great :)


  • 1
    There is this article - Getting a list of sites that a user has access to in SharePoint - which uses Search Results web part to display all sites where user has access. Probably can be a starting point.
    – Naveen
    Commented Aug 11, 2015 at 8:17
  • please mention the version if sharepoint and if farm solution is allowed!
    – Taran Goel
    Commented Aug 11, 2015 at 9:12
  • also you want all the sites in the site collection or only the ones below the site on which page exists.
    – Taran Goel
    Commented Aug 11, 2015 at 9:12

1 Answer 1


You can check the permissions of a user using the 'DoesUserHavePermissions' method. See code sample below.

However in order to return all the sites you need to loop over all the sites and site collections. This is very resource intensive! I would not recommend it on a webpage or when the code will execute a lot. On a webpage you risk getting slow page responses and time-outs.

In a timerjob that runs only a few times a week or in a one-off script I might consider it.

Personally, I would look into a search solution and some form of (custom) caching.

  • Create a content type with the needed info (user, permission).
  • For each site, let a timerjob update a (hidden) list with items based on this content type
  • Use search to get the information. (Filter on contenttypeid and user)

This is sort of a workaround. Not realtime, but it will be faster than looping over all sites. And more importantly will use a lot less resources.

Make sure you configure the scheduling of the timerjob and the search crawl job correctly.

using (SPSite site = new SPSite("http://localhost"))
    using (SPWeb web = site.OpenWeb())
        SPBasePermissions permissionToCheck = SPBasePermissions.ManageLists;

        string login = web.CurrentUser.LoginName;
        if (web.DoesUserHavePermissions(login, permissionToCheck))
            //user has permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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