Learn how to aggregate list item data across sites and sub-sites in the same site collection using the CreateSPSiteDataQuery methods of the SPUtility context object. The CreateSPSiteDataQuery method is used to create a new instance of the SPSiteDataQuery object which can be used to...
- Aggregate data from lists of the same server template (e.g. Announcements - 106), base type (e.g. Generic), collection of list IDs, or lists with the same index.
- Define a list of fields and ‘Project Properties’ to read.
- Aggregate data from the site collection, current web or recursive webs.
- Filter and sort lists data using CAML.
- Limit the max number of rows returned by the query.
Prerequisites
This example requires one site (Home) and one sub-site (Vendors) each containing one or more Announcements lists. This example uses the following SharePoint data.
Site: / (Home)
- List: Global Announcements List
- Item: Global Announcement 1
- Item: Global Announcement 2
Site: /Vendors (Vendors Site)
- List: Vendor Announcements List
- Item: Vendor Announcement 1
- Item: Vendor Announcement 2
Syntax
| Aggregate List Items ACross Sites | Copy Code |
|---|---|
|
## Setup site data query inputs
## Create the site data query
## Execute the site data query
#foreach($dataRow in $dataTable.Rows) | |
Output
