I Have a List Called Alerts with two columns as Start Date and End Date
I am Trying to generate a CAML Query that retrives only cloumns for which alerts should display within that DATE range compare with DateTime.now
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI Have a List Called Alerts with two columns as Start Date and End Date
I am Trying to generate a CAML Query that retrives only cloumns for which alerts should display within that DATE range compare with DateTime.now
Your CAML query should look something like this
...
<Query>
<Where>
<And>
<Gt>
<FieldRef Name="EventDate"/>
<Value Type="DateTime">
<Today OffsetDays="-NumDays"/>
</Value>
</Gt>
<Lt>
<FieldRef Name="EventDate"/>
<Value Type="DateTime">
<Today OffsetDays="NumDays"/>
</Value>
</Lt>
</And>
</Where>
</Query>
....
Swap out EventDate with whatever date field you're checking, and NumDays with whatever number you're generating to check between. Make sure you keep the quotes around NumDays.
Whenever I want to figure out what a CAML Query should look like I create a list view and filter it in the browser then fire up SP Designer to look at the Query portion.
There are also some online tools out there for figuring out what the query should look like..