How to View All SharePoint Sites You Have Access to (Guide)

How to View All SharePoint Sites You Have Access to (Guide)

Last Updated on January 16, 2024

Need to see all the sites you can access?

In this guide, you will learn 2 methods to view all sites you have access to, why the start page doesn’t help, and a PowerShell script you can use.

Let’s get started.

The Start Page Doesn’t Help

There is an easy way to find all the sites that you follow and those that you recently visited.

It’s on the start page of your SharePoint Online environment:

the basic components of the start page

Unfortunately, you won’t be able to find all the sites that you have access to.

On the bright side, there are easy ways you can do that.

Related: SharePoint Start Page: The Ultimate Guide for Newbies

Sign up for exclusive updates, tips, and strategies

    How to View All Sites You Have Access To

    There are two methods you can use here:

    • Search: For your personal use
    • HCWP: For you or other users

    Method 1: Use the search feature

    All you need to do here is use the search box on any SharePoint site and type in the following:

    contentclass:STS_Site

    Note: If you want to search for subsites instead, just use the query contentclass:STS_Web.

    After the system displays the result, go into the sites tab.

    There you will see all the SharePoint sites that you have access to:

    find all the sites you have access to in the sites tab

    Related: Search Guide: SharePoint Search Tips and Tricks Overview

    You can also use PowerShell to achieve similar results.

    Here’s a sample script you can use:

    # Connect to SharePoint
    Connect-SPOService -Url https://tenant-admin.sharepoint.com
    
    # Set the user's email address
    $userEmail = ""
    
    # Get all site collections in the tenant
    $sites = Get-SPOSite -Limit All
    
    # Loop through each collection and check if the user has access
    foreach ($site in $sites) {
        # Get the user's permissions for the site collection
        $permissions = Get-SPOUser -Site $site.Url -LoginName $userEmail -ErrorAction SilentlyContinue
        if ($permissions) {
            # If the user has permissions, output the site collection URL
            Write-Host "User $($userEmail) has access to $($site.Url)"
        }
    }
    

    This script connects to SharePoint, fetches site collections, and checks user access to each site.

    Naturally, the results are security trimmed, so you only see all the sites that you have access to.

    Method 2: Use HCWP

    This method requires you to create a new page and use the highlighted content web part.

    Create a new page as you usually would and then add HCWP to the page:

    find the hcwp from the list of web parts

    From there, you need to edit the web part and use the following filters:

    1. Source: All sites
    2. Type: Pages
    3. Filter: Content includes the words
    4. Words: “STS_Site”

    You can then change the layout and make sure to display more items (like 50 or 100) at a time:

    all sites - pages - content includes the words - sts site

    On the live preview, you can see that all the sites are now being displayed.

    Any other users who will visit this page will also see all the sites that they have access to.

    Got more questions about viewing all the sites you have access to? If that’s the case, kindly leave a comment below.

    For business-related inquiries, you can contact me anytime using the contact form. I will reply as soon as possible.

    About Ryan Clark

    As the Modern Workplace Architect at Mr. SharePoint, I help companies of all sizes better leverage Modern Workplace and Digital Process Automation investments. I am also a Microsoft Most Valuable Professional (MVP) for SharePoint and Microsoft 365.

    Subscribe
    Notify of
    guest
    1 Comment
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments

    Haris Hassan
    Haris Hassan
    1 year ago

    How do I access visitor log and Access spa pal?

    1
    0
    Would love your thoughts, please comment.x
    ()
    x
    Scroll to Top