SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to get all webs in Farm or WebApplication with one Linq to SharePoint query?

Now my data context constructor takes only takes one argument, and that is one web. This way I need to loop though all webs, which feels clumsy and inefficient.

share|improve this question
up vote 2 down vote accepted

OOTB Linq2SharePoint data context (generated by SPMetal) can be used in scope of web, not application. There is no easy way to expand the context to application scope.

share|improve this answer
Yep, +1, and in addition: as far as I know, the only way to fetch cross-SPWeb data in one request, is to use CAML queries in conjunction with SPSiteDataQuery and SPWeb.GetSiteData method. And cross-site collection - there is no such capability at all... – Andrey Markeev Sep 16 '11 at 18:03
To bad it is not possible. I hoped Linq to SharePoint would be easier to work with than CAML. – Tim Sep 17 '11 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.