1

I have the following CAML:

ViewXml = @"<View>
                <Query><Where><AND>
                    <Eq><FieldRef Name=""Status""></FieldRef><Value Type=""Text"">New</Value></Eq>
                    <Eq><FieldRef Name=""State""></FieldRef><Value Type=""Text"">WA</Value></Eq>
                </AND></Where></Query></View>

I'm trying to return results from a list when Status is equal to new and State is equal to WA. The query looks correct to me but when I try to execute the above I receive:

Value does not fall within the expected range.

I'm confident that the CAML query is the issue as this same block of code will execute with other queries that only check one value on the list. What am I doing wrong in this particular instance?

1

Ended up solving this one myself, casing on my and statements was the issue.

Working query is:

ViewXml = @"<View>
                <Query><Where><And>
                    <Eq><FieldRef Name=""Status""></FieldRef><Value Type=""Text"">New</Value></Eq>
                    <Eq><FieldRef Name=""State""></FieldRef><Value Type=""Text"">WA</Value></Eq>
                </And></Where></Query></View>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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