Show all sites, regardless if you are a member

AT2313w 1 Reputation point
2022-07-25T12:54:22.57+00:00

Hi all,

Currently I have a page which serves as a directory to SharePoint sites you have permission to access. It uses this query in PnP search: contentclass:STS_Site

This works just fine.

I'd also like to create a directory showing all our SharePoint sites, regardless of whether the user accessing has permission to see them.

So, if contentclass:STS_Site shows 10 sites you have access to, this new page will show 15 sites, 10 you have access to and 5 you don't. Just a normal list will be fine.

Does such a query exist?

Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Xuyan Ding - MSFT 7,601 Reputation points
    2022-07-26T08:52:48+00:00

    Hi @AT2313w ,

    According to the current policy, users in SharePoint could not see sites that they do not have access to.

    As a workaround to show all sites, maybe you can export all sites as csv files through PowerShell (Sufficient permissions required), and then display them through web part. Of course, this is only to display some information about the site, and it cannot be updated automatically and needs to be run manually.

    Something like this: on the left is the file (using the web part of the Document library), on the right is the selected file information display (using the web part of the File viewer)
    224821-image.png

    Reference: Get All Site Collections using PowerShell
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.