Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

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.