Linq for all sites and subsites on a sharepoint server?

I am working on a web part for installing sharepoint 2010. It has several sites, and each site has pages, and they can have sub-sites that have more pages and sites. I want to get a list of all pages of the entire installation that meet certain criteria (for example, title == "Test").

I can do this using the SPSiteDataQuery CAML object and set the 'Webs' property to <Webs Scope="Recursive" />. Obviously, this forces the request to consider the current site and all child elements.

On the other hand, I want to use linq2sp if possible, as this will provide an easier learning curve for other developers. Using SPMetal, I can create a DataContext for my site and then request it using linq, but this will only access the pages on the root site.

Is there a way to control the Linq query scope so that it works on all pages on all sites?

thanks s

+3
source share
1 answer

... ... , ( ) . LINQ to Sharepoint SPQuery, . SPSiteDataQuery Microsoft.SharePoint.Linq. , , , .

EntityList <TEntity> .ScopeToFolder.

Sharepoint LINQ, , . , .

+1

Source: https://habr.com/ru/post/1752503/


All Articles