Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 892925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:08:18+00:00 2026-05-15T14:08:18+00:00

We have a Site Collection with several Team Sites. Each Team site has a

  • 0

We have a Site Collection with several Team Sites. Each Team site has a task list.

We would like to show an aggregated list of tasks in all team sites on the root site. What is the best way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:08:18+00:00Added an answer on May 15, 2026 at 2:08 pm

    You can use SPSiteDataQuery to query all lists across all webs of a collection. You can query for a specific type of list by passing a ServerTemplate value to the SPSiteDataQuery.Lists property. The ServerTemplate ID for Tasks is 107. Querying all webs is accomplished by passing the “SiteCollection” value to the SPSiteDataQuery.Webs property.

    SPSiteDataQuery returns a DataTable with very limited information (only list and item IDs I think) so you have to specify all extra fields in the SPSiteDataQuery.ViewFields property.

    The following code (adapted from the class documentation sample) will return all Tasks in progress, order by their start date descending:

    SPWeb web = SPContext.Current.Web;
    SPSiteDataQuery query = new SPSiteDataQuery();
    
    //Ask for all lists created from the tasks template.
    query.Lists = "<Lists ServerTemplate=\"107\" />";
    
    // Get the Title field.
    query.ViewFields = "<FieldRef Name=\"Title\" />" ;
    // Set the criteria and sort order.
    query.Query = "<Where>" +
                           "<Eq>" +
                                 "<FieldRef Name='Status'>" + 
                                 "<Value Type='Choice'>In Progress</Value>" +
                           "</Eq>" +
                       "</Where>" +
                       "<OrderBy>" +
                           "<FieldRef Name=\"StartDate\" Ascending='False'/>" + 
                       "</OrderBy>";
    
    // Query all Web sites in this site collection.
    query.Webs = "<Webs Scope=\"SiteCollection\" />";
    
    DataTable dt = web.GetSiteData(query);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a site collection and then create two team sites on sharepoint
I have created a site collection inside a web application with user A as
So I have site list on certain pages that basically just have links to
I'm having this issue on several server environments. We have a list at the
The site I'm working on has a collection of navigation elements across the top
We have a Win 2008 server running IIS7. The webserver runs several sites, one
I have several flash movies on a site. They all loop through an animation
I have 3 databases, and now I need to join several tables from each
I have created one site column in the one site collection. I created another
I inherited a SharePoint 2007 site collection that has a myriad of subwebs. To

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.