Bug involving query and the ‘&’ character

Home Forums SPJS-Utility Bug involving query and the ‘&’ character

Viewing 1 reply thread
  • Author
    Posts
    • #36409
      Mitchell T
      Participant

        Hello Alexander,

        I seem to have discovered a possible bug with the spjs.utility.queryItems function. The query does not seem to work if the queried text contains and ‘&’ character. For example the following query would not return results:

        var qRes = spjs.utility.queryItems({
        “listName”: “List_Name”,
        “query”: “<Where><Eq><FieldRef Name=’Title’ /><Value Type=’Text’>foo&bar</Value></Eq></Where>”,
        “viewFields”: [“foo”, “bar”]
        });

      • #36412
        Alexander Bautz
        Keymaster

          Hi,
          In a CAML query you must append “amp;” to your & – for some reason I cannot write it out here because the character is changed to a plain & when I submit the comment.

          or wrap the value part of your query like this:

          <Eq><FieldRef Name="Title" /><Value Type="Text"><![CDATA[foo&bar]]></Value></Eq>
          

          Alexander

          • This reply was modified 1 year, 9 months ago by Alexander Bautz.
          • This reply was modified 1 year, 9 months ago by Alexander Bautz. Reason: struggling with the formatting
      Viewing 1 reply thread
      • You must be logged in to reply to this topic.