While I am in the blogging mood today, I thought I would share a very helpful link. I was trying to figure out the proper way to retrieve the latest recurring events based on the current month. I Googled around for a bit before stumbling upon this:
The key point is the query used:
SPQuery query = new SPQuery();
query.ExpandRecurrence = true;
query.Query =
"<Where>" +
"<DateRangesOverlap>" +
"<FieldRef Name='EventDate' />" +
"<FieldRef Name='EndDate' />" +
"<FieldRef Name='RecurrenceID' />" +
"<Value Type='DateTime'><Month /></Value>" +
"</DateRangesOverlap>" +
"</Where>";
// Look forward from the beginning of the current month
query.CalendarDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);