The CrossSiteDataSource works by constructing a SPSiteDataQuery object in the WSS V3 object model. This site data query is a much more efficient means of aggregating data across multiple sites without having to programmatically access each site. At the same time, SharePoint will also take user security into account so that the user browsing the page containing the rollup will only see data aggregated from sites and lists that they have rights to.

Sample Configuration

Configuration below returns last 20 items that were modified by currently logged in user.
<CrossSiteDataSource ContentType="Item" TopLevelSite="/" Scope="Recursive" Lists="100" QueryRowLimit="20" ID="DSC">
<Fields>
     <FieldRef Name="Title" />
     <FieldRef Name="Modified" />
</Fields>
<Query>
     <Where>
          <Eq>
               <FieldRef Name="Editor"/>
               <Value Type="Integer"><UserID/></Value>
           </Eq>
          <OrderBy>
                 <FieldRef Name="Modified" Ascending="False" />
          </OrderBy>
     </Where>
</Query>
</CrossSiteDataSource>

Properties

  • Scope [Web|Recursive|SiteCollection] - this property is used in conjunction with the TopLevelSite property.
    • Web - The query will only search the site specified in the TopLevelSite property.
    • Recursive – The query will start at the TopLevelSite url and search that site as well as all child sites.
    • SiteCollection – Will ignore the top level site and will start at the root of the portal and search all sites in the site collection.
  • DatesInISO8601 [True|False] – This option specifies that additional processing should occur to format dates. Dates from SharePoint are return in ISO 8601 format and the option re-writes the date into a format more suitable for display.
  • FixLookups [True|False] – SharePoint lookup fields are formatted for internal use. This option will parse any lookup fields into a format more suitable for presentation.
  • Lists – Limits the query to lists of the specified server template id. Can also contain the server template id of any custom list definitions created for the site collection being rolled up. Some default options include:
    • Document Library – 101
    • Picture Library – 109
    • Announcements – 104
    • Contacts – 105
    • Discussion Board – 108
    • Links – 103
    • Calendar 106
    • Tasks – 107
    • Issues – 1100
    • Survey – 102
    • Custom – 100
  • QueryRowLimit – Maximum number of items returned in the Data Source.
  • ContentType – This parameter is optional. If no query is specified in the <Query> node, the datasource will construct a query using the content type specified. If a <Query> is present, this parameter will be ignored.
  • ID – Unique identifier for data source.
  • TopLevelSite – Specifies the URL of the site to be used as the starting point for a rollup. Can be a relative or absolute URL. Ignored if the Scope property is set to SiteCollection.
  • IncludeListData [True|False] – This option will add additional fields to the Data Source being returned. Note: This option adds additional processing that can affect performance negatively when used with large Data Sources. Fields Include:
    • WebId
    • ListId
    • ListUrl
    • ListTitle
    • SiteTitle
    • SiteUrl
    • ItemId
    • ItemUrl (display form)
    • ItemEdit (edit form)
  • Fields
    • This node should contain FieldRef nodes that reference the field that should be returned in the data source. The field name should be the Internal Name of the field and not the display name.
    • Alias - optional attribute can be used to rename the fields.
    • Match - optional attribute that accepts regular expression. Used to extract particular substring from field's value.
<Fields>
     <FieldRef Name="Title" />
     <FieldRef Name="Modified" />
     <FieldRef Name="Editor" Alias="Modified By" />
</Fields>
  • Query
    • This node should contain a SharePoint CAML query that will be used to filter results. Supports live fields
<Query>
     <Where>
          <Eq>
               <FieldRef Name="ID"/>
               <Value Type="Integer">[QS:id]</Value>
          </Eq>
          <OrderBy>
               <FieldRef Name="Modified" Ascending="False" />
          </OrderBy>
     </Where>
</Query>

Last edited Jul 6, 2011 at 3:05 PM by fildalex, version 2

Comments

No comments yet.