SharePoint – Security Trimmed list of sites

I was recently asked about getting a list of site collections that the users would have permissions to (security trimmed). The first thought was utilizing search since we would want to security trim the list.

1. Edit the Modern page

2. Add in the Highlighted Content Web part

3. Edit the Web Part

4. This will show many options on the right side of the page. We want to leave it on Filter. Next, we want to select Selected sites or All sites. Depending on if you would like to consider all the site collections in your tenant.

5. Change the Type from Documents to Pages.

6. The Filter selection needs to be changed to Managed property. More on managed properties here: https://docs.microsoft.com/en-us/sharepoint/manage-search-schema

7. In the Find a managed property, enter in content. Then select ContentClass, Equals, STS_Site. We could look for Subsites within site collection(s) by using STS_Web.

8. After this is done, you can see the web part update in real time. This will show the sites (items) only if that user has permission.

Leave a Reply

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