SharePoint Online: How to show all sites a user has access to?

Requirement: Display a list of all SharePoint Online sites a user can access.

How do I view all sites I have access to in SharePoint Online?

In SharePoint Online, you may have noticed that there’s no easy way to view all the sites you have access to. Although the SharePoint start page (https://YourDomain.sharepoint.com/_layouts/15/sharepoint.aspx) displays Frequent, Recent, and following sites, It may not give the complete list of all sites you have access. So, it may not be easier to get the site unless the user remembers the URL or bookmarked it.

how to show all sites you have access to in sharepoint online

So, How to view all SharePoint Online sites I have access to? Well, there is a workaround!

Option #1: Use Search to List All the Sites You Have Access

Here is how to use the SharePoint search to get a list of all sites you have access to:

  1. Login to https://www.office.com >> In the App Launcher, click on “SharePoint” to get the SharePoint Online start page.
  2. On the search box, type “contentclass:STS_Site” and hit enter.
  3. Click on the “Sites” tab, and this will show all sites you have access to. sharepoint online view all sites i have access to

If you want to include subsites as well, use the search query: contentclass:STS_Site OR contentclass:STS_Web

Add this link to “Featured Links” in SharePoint Home page: https://YourDomain.sharepoint.com/_layouts/15/sharepoint.aspx?q=contentclass%3ASTS_Site&v=%2Fsearch%2Fsites

Option #2: Create a Page to Show All Sites User has Access

Let’s create a page that shows all sites a user has access to. You can also use the Search results web part to achieve this functionality.

  1. Go to your SharePoint Site >> Create a new page >> Add a “Highlighted Content web part” web part to it.
  2. Set the Highlighted Content web part properties as below:
  3. Content: Source – All Sites, Type – Pages, Filter and sort: Content includes the words – STS_Sitesharepoint online list all sites a user has access to
  4. Set the Layout as “List” and Number of items to 100.sharepoint online get all sites user has access to

Save and publish the page. This page shows all sites a user has access to in SharePoint Online.

sharepoint online show all sites i have access to

Both methods use search to retrieve all sites you have access to. The security trimming will be applied, and you’ll receive only sites to which you have access.

PowerShell to Find All SharePoint Online Sites user has Access

How about getting all sites a particular user has access to with the help of PowerShell?

#Parameters
$AdminCenterURL = "https://crescent-admin.sharepoint.com"
$UserID = "salaudeen@Crescent.com"

#Connect to SharePoint Admin Center
Connect-SPOService -Url $AdminCenterURL

#Get all site collections in the tenant - Excluding specific site types such as redirect site, search center, etc.
$Sites = Get-SPOSite -Limit All | Where -Property Template -NotIn ("SRCHCEN#0", "REDIRECTSITE#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "EDISC#0", "STS#-1")

#Loop through each site collection
ForEach ($Site in $Sites) {
    # Try to get the user from the site
    $Permissions = Get-SPOUser -Site $Site.Url -LoginName $UserID -ErrorAction SilentlyContinue
    If ($permissions) {
        Write-Host "User $($UserID) has access to $($Site.Url)"
    }
}

The above method gets the site URL. However, this method may not be perfect in scenarios where the user is part of an AD group. If you want to get what permissions a particular user has on the site, You have to Generate a SharePoint Site User Permissions Report

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

13 thoughts on “SharePoint Online: How to show all sites a user has access to?

  • is it possible filter only where user has access as contributor for example. at the moment list included all rights included reader (everyone).

    Reply
  • These are great suggestions. For Option #1 is there any way to sort them alphabetically or by most recently accessed?

    Reply
  • Hi Salaudeen Rajack !
    First of all, wonderful job with this site !
    Is there a way to add an “highlighted content web part” to the user homepage ? Actually, I don’t know if it’s possible to modify the user homepage at all.

    Thank you

    Reply
    • Sure! The default Home page is at: /SitePages/Home.aspx, You can edit and add the web part on your SharePoint Online site.

      Reply
      • I misspoke, I was talking about the user portal home page (www.office.com) not the site home page.

        Reply
  • Can you query for a specific user? I want to find out a list of sites a specific staff member has access to.

    Reply
    • Hi, I’m having the same issue, how to view what folders a specific user has access to…
      thank you for your help
      Peter

      Reply
    • I have the same need. Did you figure this out?

      Reply
      • Same question here! Does anyone know?

        Reply
    • Took ma while to figure out but if you can’t use the method in this article because the user can’t sign in you can do this with powershell.

      #connect to sharepoint admin portal
      #verbinding pnp (met deze moet je het per site doen)
      $tenants = “id of tenant”
      $app = “app which has access to all sites”
      $thumprint = “certificate which you have uploaded in the app”
      Connect-PnPOnline -Tenant $tenants -ClientId $app -Thumbprint $thumprint -Url https://yourdomain-admin.sharepoint.com/

      #get all the sites without the default site, portals or search. This filter also excludes the redirect template sites. Not doing this will give you an unknown error if you do a Get-PnPUser on the site
      $sites = Get-PnPTenantSite -Filter ‘Url -notlike “*/portals/*”‘|where {($_.url -notlike “*/search”) -and ($_.url -ne “https://lumconline.sharepoint.com/”) -and ($_.Template -ne “RedirectSite#0”)}|select Url

      # Loop through all site collections
      foreach ($site in $sites) { 
      Connect-PnPOnline -Url $site.Url -Tenant $tenants -ClientId $app -Thumbprint $thumprint
      # This part is only for site collection admin check
      # in this case i use a displayname for the user im looking for
      $gottem = Get-PnPSiteCollectionAdmin|Where-Object {($_.title -like “*displayname*”)}
      if ($gottem -ne $null){Write-Host $gottem.title ” is sitecollection admin on ” $site.url -ForegroundColor Yellow}
      # If you want to remove the site collection admin
      #Remove-PnPSiteCollectionAdmin -Owners $gottem.Email”
      # This part is for users in groepen, AD Groups or root permission
      # in this case im using the primary emailadres of the user which should be the same as the UPN
      $Users = Get-PnPUser -WithRightsAssigned|Where-Object {$_.Email -eq “mail@adres.com”}
      if ($Users -ne $null){Write-Host $Users.Title ” has permissions on ” $site.url -ForegroundColor Green}
      }  

      PS: If you have a lot of site collections split the search in multiple batches. If you don’t do this it will trough you a timeout error. In my case It trough me an error once but the second time it didnt. I think the sweetspot is checking for around 1500 sites per loop.

      Reply
      • Hi, What would I do if I don’t have an app I just need All the Sites the User has permission to access. Is there another way?.

        Reply
  • Hi Salaudeen, thanks for sharing such great content. I follow your posts since a long time ago.
    Question, is it possible to do this from PowerShell or some API Call?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *