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

I have the following CAML query:

caml = string.Format("{0}", code);

query = new SPQuery { Query = caml, ViewAttributes = "Scope = \"RecursiveAll\"" };

This query search in a document library a list of items sprawl in the subfolders. I would like to translate it in LinqToSP and I do that:

var list = dc.GetList("MyDocs"); list.ScopeToFolder(string.Empty, true); var items = list .Where(s => s.Code.Id.Equals(item.Id));

but in this way I don't get any item. Why? Tnx

share|improve this question
caml = string.Format("<Where><Eq><FieldRef Name=\"LookupToMyCode\" LookupId=\"TRUE\" /><Value Type=\"Lookup\">{0}</Value></Eq></Where>", code); – Gaetanu Jul 7 '12 at 7:37

You need to query results of ScopeToFolder call. And first parameter shoul contain list url, not empty string.

share|improve this answer

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.