After spending a bit of time trying to figure out the correct CAML to show all future items with the inclusion of recurring items. I thought I’d just blog it to save me the hassle if I need to use it again
All Calendar Items CAML
- var query = new SPQuery {
- Query = @"<Where>
- <DateRangesOverlap>
- <FieldRef Name='EventDate'/>
- <FieldRef Name='EndDate'/>
- <FieldRef Name='RecurrenceID'/>
- <Value IncludeTimeValue='TRUE' Type='DateTime'>
- <Now/>
- </Value>
- </DateRangesOverlap>
- </Where>
- <OrderBy>
- <FieldRef Name='EventDate' Ascending='TRUE'/>
- </OrderBy>",
- ExpandRecurrence = true,
- RowLimit = Convert.ToUInt32(this.ItemsToDisplay)
- };