The following code is the easiest way I have found to retieve items from a list using a date range.
Microsoft.SharePoint.SPQuery camlQuery = new Microsoft.SharePoint.SPQuery(); camlQuery.Query = @"<Where> <DateRangesOverlap> <FieldRef Name=""EventDate""></FieldRef> <FieldRef Name=""EndDate""></FieldRef> <Value Type=""DateTime""> <Now/> </Value> </DateRangesOverlap> </Where> <OrderBy> <FieldRef Ascending='TRUE' Name='EventDate' Type='DateTime' /> </OrderBy>" ; |
No comments:
Post a Comment