Quantcast
Channel: SharePoint – Gordon Duthie's Blog
Viewing all articles
Browse latest Browse all 21

SharePoint: CAML for all future calendar items including recurring

$
0
0

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
  1.  
  2. var query = new SPQuery {
  3.     Query = @"<Where>
  4.                  <DateRangesOverlap>
  5.                     <FieldRef Name='EventDate'/>
  6.                     <FieldRef Name='EndDate'/>
  7.                     <FieldRef Name='RecurrenceID'/>
  8.                     <Value IncludeTimeValue='TRUE' Type='DateTime'>
  9.                         <Now/>
  10.                     </Value>
  11.                  </DateRangesOverlap>
  12.               </Where>
  13.               <OrderBy>          
  14.                 <FieldRef Name='EventDate' Ascending='TRUE'/>      
  15.               </OrderBy>",
  16.     ExpandRecurrence = true,
  17.     RowLimit = Convert.ToUInt32(this.ItemsToDisplay)
  18. };


Viewing all articles
Browse latest Browse all 21

Latest Images

Trending Articles



Latest Images