1
$caml = '<Where><AND><Neq><FieldRef Name="marking" />
<Value Type="Text">Off-S</Value></Neq><Neq><FieldRef Name="marking" />
<Value Type="Text">Off</Value></Neq></AND></Where>'

I have this query, which doesn't return anything. What I want is it to return all the items that are in the column marking that are not equal to Off-S and Off

  • 2
    Stop hand writing CAML queries, when a great tool such as CamlDesigner exists (camldesigner.com) – MdMazzotti Jun 12 '14 at 12:48
3

Your <And> tag is in all caps; CAML is case sensitive. Try this:

<Where>
    <And>
        <Neq>
            <FieldRef Name="marking" />
            <Value Type="Text">Off-S</Value>
        </Neq>
        <Neq>
            <FieldRef Name="marking" />
            <Value Type="Text">Off</Value>
        </Neq>
    </And>
</Where>

And like MdMazzotti said, use a tool to build your CAML queries.

2

CAML keywords are case-sensitive, try writing "And" instead of "AND".

0

I use a caml query tool called U2U Caml query. Its free and easy. http://www.u2u.be/Software

-2

Have you tried :

$caml = '<Where><AND><Or><Neq><FieldRef Name="marking" />
<Value Type="Text">Off-></Value></Neq><Or><Neq><FieldRef Name="marking" />
<Value Type="Text">Off</Value></Neq></Or></Or></AND></Where>'

maybe this helps you

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.