When Office 365 was first released, one of the key missing items was the Content Search Web Part – it was only available for on-premise implementations. As an addition to the Content Query Web Part in SharePoint 2010 (and still available in SharePoint 2013), it provides key features in aggregating content across sites and site collections. It provides the ability to roll-up lists of documents based on pre-designed queries.
As of October, 2013, the Content Query Web Part is now available to the following subscription plans: Office 365 Enterprise E3 and E4, Office 365 Education A3 and A4, Office 365 government G3 and G4, and Office 365 Enterprise E3 for Nonprofits.
Why is the Content Search Web Part so powerful and useful? A couple key reasons:
- Aggregation of content across multiple site collections: the CSWP can provide lists of items that span multiple site collections.
- Easy filtering of content: the CSWP can filter results to just documents, list items, particular content types, matching metadata, etc. to provide a very specific list of items.
- Use of search display templates: the CWSP uses search display templates to display items which is a huge improvement over the XSLT hand-coding required in SharePoint 2010.
An Example: News and Announcements
I have two site collections: SearchDemo1 and SearchDemo2. In each site collection, I created a News and Announcements list.
Imagine that you have multiple departments, each with their own site collection. However, you also have a main corporate intranet where you want to display all the news aggregated from various departments in your organization. The CSWP is how to easily accomplish this task.
Adding the Content Search Web Part
Adding the Content Search Web Part to any page is easy – just edit the page and add the web part!
By default, the CSWP displays a list of recent search items. We can now configure the web part to display just news items and reformat the presentation of items to be more like a list than an image gallery.
Configuring the Content Search Web Part
To configure the CSWP, you can edit the page and edit the web part properties either through the ribbon at the top of the page or in the context menu of the web part.
Let’s configure the part to only display news items, to show 2 results and to change the display to be more like a news list and remove the picture on the left.
Changing the Query
Click on “Change query” allows you to specify the items returned in your list. In this case, we want all news items across all the site collections.
- By selecting “Items matching a content type (System)” under “Select a query” we can specify that we only want to display items of type “Announcements”.
- By selecting “Don’t restrict results by app” under “Restrict by app” we will return results across all site collections.
In the search results preview, you can see that only news and announcement items are now returned and the results are from both our site collections.
Changing the Items to Show
Changing the “Number of items to show” will increase or decrease the number of items on the page. Let’s change this number to 2.
Changing the Display
Our default display template isn’t that helpful because news and announcements don’t have images to display. Let’s change the display template to be more news oriented. Under item, let’s change this to be “Two lines”.
Note: display templates are easily customizable and you can create new templates using some basic HTML skills.
We can also change the title of the web part under Appearance. Let’s change it to “News and Announcements”.
The Final Result
Here is the final result of our configuration. We have now a list of news items that is aggregated across all site collections!
This is a simple example but with these configuration options and some custom display templates your ability to show results from all your site collections in home pages, corporate communications intranets, etc. can be easily managed with little to no custom development and easy web part configuration.