How To Perform Data Rollups Across SharePoint Site Collections

Say you have a typical corporate site with a home page containing news, events and whatever else data you need on a typical site. Also, if it’s a typical corporate site, you’re also likely to have department sites and various team sites, some of which are site collections and other sub sites.
The structure may look close to the one below:

SharePoint Site Collections

SharePoint Site Collections

With a structure like above, it’s often that users ask to see various information published on the home page on their respective sub sites and vice versa. Whether those are news, calendar events, announcements or wiki pages – you can use SharePoint Content Search Web Part (CSWP) to achieve this goal. CSWP uses search index to pull information across multiple sites, also you have your usual security trimming etc.

Let’s take a look at an example where you can use CSWP to share announcement across sites.

1. Create a list of an announcement type (aka Announcements App) on the root site collection

2. Create a managed metadata term set (Gear | Site Settings | Term store management) representing Category of the announcement
This will allow our announcements to be categorized and administrator can chose to show rollups of certain categories only on specific sites

2

3. Back in our announcement list, add a new column to that list representing a category and make it a managed metadata type column, set the column to consume data from the term tree we have just created. Remember the name of it since we’ll need it later. In my case, for reference let’s call it MyAnnouncementCategories

3

4. Create an instance of at least one announcement which uses the term set column. This piece if very important since search will need to crawl this piece of content in order to create searchable properties which we’ll need later.

5. If you’re using SharePoint Online, at this point you will need to wait until search crawl has completed and picked up your content. From my experience it may take 1 or 2 hours until this is done. if you’re using on-premises environment, you can expect for the crawl to happen faster plus you can always trigger it and have your properties created within minutes.

6. Navigate to the site where you’d want to see the roll up of announcement and add an instance of CSWP, add a Content Search Web Part and access it’s properties

4

 

7. Click the Change Query button and switch to Advanced Mode

8. In here under the Query Text add the following:

(contentclass:”STS_ListItem”) owstaxIdMyAnnouncementCategories:#1e44855f-c4d8-43a1-96cf-69bd67a51197

Above query filters all of the crawled items which:
-Are list items

-MyAnnouncementCategories is equal to desired taxonomy term representing a category you want to filter on. Typically after SharePoint completes it’s crawl of data and picks up managed metadata property, it will create a managed property representing taxonomy ID of the managed metadata column. The name of the column usually has a format of owstaxId[ColumnName] so in our case it’s owstaxIdMyAnnouncementCategories. The GUID following the filter can be taken from the term store management tool. For examaple, in my case the unique ID of the Category 2 is as shown below:

5

This means that you want to filter announcements by certain category on one site and by different category on another site – you can do such filtering by specifying the Id of the category.

The cool part of this is that if you chose a parent category Id, you will see all of the items tagged with a parent category and child categories.

9. Save the Web part properties and test the query.
Remember if you’re using SharePoint Online the crawl may take some time for new items to be picked up so you might want to create some demo content tagged differently prior to doing the whole web part configuration to give it some time.

In a next post, I’ll demonstrate how you can style the results returned by CSWP to make them look how you want.

Enjoy!

This article was first published by Yaroslav on ShareMiuch.com . For more inofrmative content fromYaroslav check out our resource centre here where you choose from a range of intomative blogs and eBooks from Yaroslav including a webinar on ’15 Minutes SharePoint Branding’

If you have any questions or feedback on Yaroslav’s article please leave a comment below. We would love to hear from you.

Ypentsarskyy _2010Yaroslav Pentsarskyy has been architecting and implementing SharePoint solutions since its 2003 release. Yaroslav has extensive .NET and SharePoint development experience working with medium-sized businesses, nonprofits, and government organizations.

As a recipient of the Microsoft Most Valuable Professional (MVP) 2009 and 2010 Award, Yaroslav is also a developer audience leader for VanSPUG (Vancouver SharePoint Usergroup) and actively contributes to local and not-so-local technical communities by presenting at technology events and sharing his findings in his almost-daily blog: www.sharemuch.com.

Share this on...

Rate this Post:

Share: