I'm working on a webpart for a sharepoint 2010 installation. This has multiple sites, and each site has pages, and may have subsites, themselves with more pages and sites. I want to get a list of all pages in the entire installation that match a certain criteria (eg title == "Test"
).
I can do this using a CAML SPSiteDataQuery object and setting the 'Webs' property to <Webs Scope="Recursive" />
. Obviously this makes the query consider the current site and all subsites.
On the other hand I want to use linq2sp if possible as it will present an easier learning curve for other developers. Using SPMetal I can generate a DataContext for my site, and then can query it with linq, however this will only access pages in the root site.
Is there some way to control the scope of a Linq query so that it works across all pages in all of the sites?
thanks, S