Content search webpart - roll up team sites

Posted on July 19th, 2014

In this video you will learn how to use content search webpart to rollup team sites within the site collection.

Use Case:

Every department in the company are using their own team site for collaboration and individual users also requesting for the creation of sites based on the demand.  To maintain the track of all team sites created, site collection administrator wanted to know all the list of team sites that has been created within the site collection.

Steps - content search webpart rollup team sites:

  1. Open SharePoint site collection. Click on Edit from home page, click insert, click on webpart and select content rollup and select Content search webpart from the lists and click on add.
  2. Content search webpart by default displays last modified items from search results.
  3. Edit webpart to see the properties of the content search webpart.
  4. From the properties click on change query
  5. From the Basics tab, click on switch to advanced mode.
  6. You need to modify the Query text to display the team sites within the site collection.
  7. To do that remove “(IsDocument:"True" OR contentclass:"STS_ListItem")” keep the path because we need to filter the values for training site collection.
  8. From the select query choose “Team sites (Tenant)”, and click on test, now you can see that you will get all the team sites created within the tenant, but we need only team sites within this site collection.
  9. Before we implement, let us understand how Team sites (Tenant) results source has been build. Results sources replacement of search scopes in SharePoint 2010.
  10. Click on result source and open in new window, this will open the Manage results sources page.
  11. From the list click on Team sites result source. Check for Query transform section on how the query has been built for this. This shows “Webtemplate:STS”. This means, Team sites (Tenant) resource source uses webtemplate managed property to filter the team sites using webtemplatename, in this case it is “STS” for team sites. Now close this window and go back to Build your query tab and search for property from property filter.
  12. Click on Show all managed properties to display all managed properties and look for webtemplate, select equals and manual value enter STS in the textbox and click on “Add property filter”.
  13. Now you can see that query text added with “Webtemplate:STS”.
  14. Change the select a query to local SharePoint results and click on “Test Query” and display all the team sites in this site collection including root one.
  15. You can change the number of items that being displayed, in this case I am changing to 10.
  16. Display templates helps you to format the results which are coming from search results.
  17. Control templates controls the overall display of the search results.
  18. Item templates controls display of individual items in search results.
  19. Change the item template to “Two lines”.
  20. You can change the property mapping setting to other managed properties, in this case we will just keep it as it is.

have you worked on content Search webpart?

Did you get a chance to work with content search webpart? If so how did you use it in your scenario or project you have worked on. You can provide the details in the comments section below.


In this video you have learned how to roll up team sites within the site collection using content search webpart. We will be providing lot of other scenarios where we can use this webpart in the coming videos. If you are using content search web part, let me know here your scenario and how are you implementing it.

› Content search webpart roll up team sites

Join 8,000 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers

About Author

Devendra Velegandla is a five-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2019) for Office Apps and Services, Office Servers and Services MVP and  SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.