tags:

views:

147

answers:

1

Hello.

I tried making Linked lists in Sharepoint designer and it worked well - I was able to link multiple sources of lists in 1 source.

However I want to link these lists programmatically (by coding), so I could add/remove some lists based on condition (well actually I want a list with template number X added to linked source automatically).

How can I achieve that?

+1  A: 

You can use the Content Query Webpart (available in MOSS) and use the ListsOverride method to specify custom list templates to be included in your search. You can do this both from your code as well as from the interface.

Here are more details, you will need to specify the list templates as

<List>

elements, according to the WSS SDK 3.0 reference.

Tudor Olariu
Thank you for tip. It`s really possible to aggregate all subwebs with a single caml query. However to make queries and aggregate them programmatically, we can use SPSiteDataQuery class. Examples here: http://darrinbishop.com/blog/archive/2007/04/08/47.aspx Looks like SPSiteDataQuery is even included in WSS. Goodie.
Janis Veinbergs