SharePoint CAML Query Date
For the past two SharePoint implementations that I’ve worked with, it was a common business requirement to query from a list to retrieve items that should be displayed on a “scheduled” basis. Think along the lines of an alert or announcement. Typically what I end doing is create a custom list and add the following three fields, “StartTime”, “EndTime” and “Active”. Start and End Time are the fields for scheduling the list item. I make them a Date+Time field and also allow them to be optionally be null, this way someone can create an open ended item that starts at a specific time but has no specified End Time. The Active field is a simple yes/no that is a convenient kill-switch or safety check.
So with the three columns, the following CAML query can be used to query items that should be currently displayed:
