views:

771

answers:

5

hello, let me explain my current situation

i have a SharePoint site lets say it is MAIN, and a subsite lets call it SUBMAIN

in MAIN i have a list called "a" and in subMAIN i have a list called "b"

both lists have the exact same columns,

i need to show the content of both lists (ordered by modified date for example) in one webpart in the main page i know it is possible some how but couldnt get to it.

currently i am showing only the content of list "a" in a content query webpart (i have changed the way it display and added to it horizontal merquee) so it will be nice if somehow i can add contents of list"b" also to the same content query webpart (but if it is not possible in content query webpart its ok, at least let me know what other options do i have)

your help is appreciated

+1  A: 

If you are using SharePoint Designer to do this, take a look at this blog.

If you are building your own web part, I would perform two queries on the SPList objects. You can then aggregate, sort, etc. the results however you would like. If you aren't familiar with SPList, you can look here for the MSDN overview.

Scott Price
+1  A: 

I've built web parts to display items from 2 different lists, and I did something similar to what Scott Price suggested. I used an SPQuery object for each list and used it to get DataTable objects that I could then use with things like Repeaters and DataLists. You could merge your two tables and do something similar.

The biggest trick for me was setting up the custom templates for DataBinding in a webpart. To do that, I created a custom class that implemented the ITemplate interface and then emitted the HTML for each item from the template class in an event handler. Then, you just create an instance of your template class and set that as the ItemTemplate property of your, say, DataList.

This post and this one do a better job of explaining that approach, but the nice thing is that you have complete control of the markup, and you can style it as you like.

Abs
A: 

If you don't want to code, I guess the Google term to use for pre-built solutions is "SharePoint list roll-up".

ROXORITY SharePoint Web Parts
A: 

If you're not looking to code your own solution, you might consider this webpart on codeplex:

http://rssaggregator.codeplex.com/

It's actually an RSS aggregator, but since all SharePoint lists have built-in RSS feeds, you can use it just as well to aggregate the SharePoint lists from the different sites.

A: 

Another approach is SLAM, SharePoint List Association Manager, an open source project my company created and actively supports. SLAM will allow you to configure those two lists to be automatically synchronized to SQL tables at which point you can create a query to join the two. If you have the two lists built off a content type (since they have the same fields) you can actually slam the content type and have both lists in the same SQL table.