I would like to have a report of which sites a specific group or user has on all the SharePoint sites.

I have this group called SPGroup and I want to see on which sites this group has permissions on, including all subsites.

Can this be done by using Client context?

I can't find anything where it explains how to do this.

2 Answers 2


If you just want to find WHERE this group has permissions at SITE COLLECTION level, but not WHAT permissions and NOT subsites, then use SharePoint Online Management Shell and:

Get-SPOUser -Site


  foreach($site in $sites){ foreach($user in (get-spouser -site $site)){ if($user.DisplayName -eq "SPGroup") {write-host $site}}}
  • I need to check permissions on the subsite level. Thanks anyway
    – ArKersten
    Jul 13, 2016 at 7:25
  • If I find the time, I'll write CSOM for the subsites and change the answer.
    – grisha
    Jul 13, 2016 at 8:38

This exists on the RoleAssignment.Groups property.


# Note -- I have a function for creating the context.
$Ctx = Get-Context $Credentials $SubSiteURL
ForEach($Group in $Ctx.Web.RoleAssignments.Groups)
    Write-Output ("{0} -> {1} -> {2}" -f $Group.Id, $Group.Title, $Group.Description)


3 -> Excel Services Viewers -> Members of this group can view pages, list items, and documents.  If the document has a
 server rendering available, they can only view the document using the server rendering.
7 -> IT TEST AREA Members -> 
5 -> IT TEST AREA Owners -> 
6 -> IT TEST AREA Visitors -> 
21 -> SharingLinks....OrganizationEdit.... -> This group is for OrganizationEdit sharing links on item 'DocURL'
26 -> TESt Members -> Use this group to grant people contribute permissions to the SharePoint site: TESt
27 -> TESt Visitors -> Use this group to grant people read permissions to the SharePoint site: TESt

Just write something to iterate through all items under the root web, like this.

Function Get-SubSites($Credentials, $SiteURL)
    # Check if this is the parent web or not
    $Context = Get-Context $Credentials $SiteURL
    # Collect whatever you want and append it to an array
    $Report += $Context.Web.Url
    ForEach($Web in $Context.Web.Webs)
        Get-SubSites $Credentials $Web.Url
$Script:Report = @()

Your Answer

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

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