AnsweredAssumed Answered

Problems with a CAML query

Question asked by grrttmrtn on Dec 7, 2015
Latest reply on Jan 12, 2016 by pfudala

Basically I am trying to query a weeks worth of events. Then I found that sometimes we'd have events that wouldn't start and end during the same week. So I needed to see if any events were starting OR ending during the week so that it would catch events that were ending during the week as well.

 

So I am trying to query Start date is greater than or equal to today or less than and equal to today+7. I did the same thing with the end date. However, it does not seem to reliably grab all events that start or end within that range.

 

<Query>

  <Lists>

    <List ID="{0FA9DDF1-3482-417E-ACB5-B5DA05A2C04A}" />

  </Lists>

  <ViewFields>

    <FieldRef Name="ID" />

  </ViewFields>

  <Where>

    <And>

        <And>

          <Geq>

            <FieldRef Name="EventDate"  />

            <Value Type="DateTime">{WorkflowVariable:VarStartDate}</Value>

          </Geq>

          <Leq>

            <FieldRef Name="EventDate"  />

            <Value Type="DateTime">{WorkflowVariable:VarEndDate}</Value>

          </Leq>

        </And>

      <Or>

        <Geq>

          <FieldRef Name="EndDate"  />

          <Value Type="DateTime">{WorkflowVariable:VarStartDate}</Value>

        </Geq>

      <Leq>

        <FieldRef Name="EndDate"  />

        <Value Type="DateTime">{WorkflowVariable:VarEndDate}</Value>

      </Leq>

  </Or>

    </And>

  </Where>

</Query>

Outcomes