SharePoint 2013 KQL for Sites User has Access

Problem: You want a webpage on your SharePoint intranet that lists only the sites the logged-in user has permissions to access.

Solution: Create a page, insert a search results webpart with a query that uses KQL.  The notes for each KQL statement were key to getting the results to show as desired.

  • KQL for websites = ContentClass:STS_Web
    note: this will return SharePoint sub-sites so they show independent of their parent sites
  • KQL for site collections = ContentClass:STS_Site
    note: this will return only the root SharePoint sites
Advertisements