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

  • caml = string.Format("<Where><Eq><FieldRef Name=\"LookupToMyCode\" LookupId=\"TRUE\" /><Value Type=\"Lookup\">{0}</Value></Eq></Where>", code);
    – Gaetanu
    Jul 7, 2012 at 7:37

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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