I have the following CAML query:

<Where><Eq><FieldRef Name="Title" /><Value Type="Text">TestDocument </Value></Eq></Where>

I have an item in the list with Title "TestDocument" without the space at the end. The value I am querying has a space at the end so I expect to find nothing. When I execute I get the item without the space in the title.

I also tried using CDATA

<Where><Eq><FieldRef Name="Title" /><Value Type="Text"><![CDATA[TestDocument ]]></Value></Eq></Where>

no luck

How can I make it so the space is actually part of the value parameter?

  • Tried with a encoded space (%20)? w3schools.com/tags/ref_urlencode.asp – Christoffer Mar 2 '18 at 11:45
  • %20 doesn't work. I also tried x0020 that also doesn't work. For now I get the item and then compare item.Title to my input param. But I would like to do that with my query – Danny Mar 5 '18 at 10:25
  • Changing <Eq> to <Contains> or <BeginsWith> does use the space when querying. But this can give me other issues. – Danny Mar 6 '18 at 14:43

Your Answer

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

Browse other questions tagged or ask your own question.