views:

1093

answers:

2

hi,

I have Task List on URL, what I want , when the page loads, the Task list should be loaded with all the aggregated tasks of its sub sites.

I want to do it in C#

+2  A: 

You may not need to develop this yourself as there are out-of-the-box solutions available.

Out-of-the-box

If you have Office SharePoint Server 2007 (not just WSS 3.0) just add the Content Query Web Part do the page where you'd like to add the aggregated data. Then configure it to display items from the Task list only.

Another option which works if you have WSS 3.0 as well is SharePoint Designer. You can add the data view web part to the page and configure it to do the same, although only from a fixed set of sites.

There are also other solutions out there that you can purchase.

Custom

If you'd still like to go down the custom route, there are also several options. Have a look at what they are on this SharePoint Dev Wiki page. Again, some of these have a requirement of Office SharePoint Server.

There is also the method of looping through the sub-sites, getting an instance to each list, and then querying that list using the techniques listed here. This isn't recommended if you have several sub-sites or lists containing a lot of items as it will be time consuming, tough on memory, and you will need to implement a caching solution.

Alex Angas
A: 

You can use a content query web part and scope only Task Lists of sub sites:

http://www.novolocus.com/2008/07/18/content-roll-up-options-part-ii-content-query-web-part/

Ajay Nayak