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:

http://blogs.msdn.com/sharepoint/archive/2007/05/14/understanding-the-sharepoint-calendar-and-how-to-export-it-to-ical-format.aspx

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); 

© 2010 FuGeRTech Suffusion WordPress theme by Sayontan Sinha