Thursday, October 8, 2009

Quering Calendar Recurrence Events

Recurrence Events in sharepoint calenders is another web part that creats calendar events for given time, daily, weekly or monthly. So how you can read this event back and get the set of recurrences behind the event? Its quite simple with CAML.But its important to understande the logic.

Check the following query



Here we retrieve all the recurences for current day.




This part will filter this data set for recurrences.

If you need to collect recurences for given day, set the calendar date of the query as follows and run the above CAML query.

Query.ExpandRecurrence = true;
Query.CalendarDate = new DateTime(2009,10,15);

You can add some more condions to this query and filter the data set. As an example folowing query will retrieve one recurrence of perticular event.