3

I am wanted to query a list which brings back items which are greater than 2 days old. I am unsure how the CAML query should look. Below is my code

<Where>
    <And>
      <Eq>
        <FieldRef Name="Status"/>
        <Value Type="Choice">NEW</Value>
      </Eq>
      <Eq>
        <FieldRef Name="Created"/>
        <Value Type="DateTime">
              what goes here
        </Value>
      </Eq>
    </And>

1 Answer 1

6

You'll want to use the Greater than or Equal operator (Geq) and then use the Today element for relative comparison:

<Where>
    <And>
      <Eq>
        <FieldRef Name="Status"/>
        <Value Type="Choice">NEW</Value>
      </Eq>
      <Geq>
        <FieldRef Name="Created"/>
        <Value Type="DateTime"><Today OffsetDays="-2" /></Value>
      </Geq>
    </And>
</Where>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.