My question is similar to this one: Query text to show sites a user can access using Search Results SP2013

However when implementing that I get a list of sites, but also links to all users' "shared with everyone" folders. The URI for those contains


I am using this query in a web part:

content class:"STS_Site" contentclass:"STS_Web"

How can I exclude the personal shared folders from the results?

We are using Office 365 and not a locally hosted Sharepoint server.

3 Answers 3


Taken directly from our SharePoint Online search results web part that shows people what sites and webs they have access to:

(contentclass:STS_Site OR contentclass:STS_Web) AND NOT WebTemplate:SPSPERS AND NOT WebTemplate:Group AND NOT WebTemplate:App AND NOT WebTemplate:AppCatalog AND NOT WebTemplate:PolicyCtr AND NOT WebTemplate:POINTPUBLISHINGHUB AND NOT WebTemplate:POINTPUBLISHINGTOPIC AND NOT WebTemplate:EDISC AND NOT */sites/app_* AND NOT *-my/* AND NOT */contentTypeHub AND NOT *-public*
  • Thank you for the quick and helpful answer. Does just what I need and now I understand how to modify these queries as needed.
    – Doug
    Oct 26, 2015 at 18:48

You actually don't even need to include contentclass:STS_Site if you're just probing for webs because every site collection includes a rootweb that will have the same URL as the site, pretty much by definition. In fact, if you for some reason don't set that up on the root of a site and call that STS_Site, then you'll potentially be pointing people to places that will throw up errors when they try to access them.


Eric’s answer can be applied not only to the Search Results web part, but also the Content Search web part and the Highlighted Content web part. Which web part to use depends on the total number of sites a user has access to (e.g. 20 total or 500+ total), the level of customization needed to display as desired, etc. View the comparison matrix I use when determining which to use at https://jennyssharepointtips.wordpress.com/2019/08/18/display-a-list-of-all-sites-a-user-can-access

Your Answer

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

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