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:
1 Comment
Comments RSS
TrackBack Identifier URI
Leave a comment
Thanks this helped me with an issue I was having where things with today’s date were not showing in the response. I added IncludeTimeValue=’True’ and everything is working sweet now.
Comment by dusty on March 1, 2011 11:15 pm