0

I'm building a webpart that queries an sp list. my list contains two fields (title, tip).

title = is a single text line and
tip = a yes/no check box

currently in my code, i am calling all items in the list:

var query = CamlQuery.CreateAllItemsQuery();

I'd like to modify it to call only items where tip is equal to "yes"

1 Answer 1

1

This should do the trick:

CamlQuery caml = new CamlQuery();
caml.ViewXml = "<View><Query><Where><Eq><FieldRef Name=\"tip\" /><Value Type=\"Boolean\">1</Value></Eq></Where></Query></View>";
1
  • 1
    It should work except the double quotes inside the string should be single or escaped.
    – Alex Angas
    Commented Mar 1, 2011 at 23:09

Your Answer

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