Archives

As I explained in a previous post, a client had need of copying appointments from an Exchange shared calendar to a SharePoint calendar.

I recently encountered a bug in calendar lists that I thought I should share. The task was to populate a SharePoint calendar with appointments from Exchange. Exchange appointments have a unique ID that I was using in SharePoint, but this ID is re-used for instances of a recurring appointment. In order to differentiate instances of recurring appointments, I would use the start time of the appointment. This worked well for most appointments but I found that it did not work for all-day appointments. The CAML query I constructed to find all-day appointments by the start time of the appointment consistently failed.

I looked at the data values for the appointment I was trying to find in Powershell, and found to my suprise that all-day appointments - no matter where they are saved from - are stored in UTC time. Apparently all appointments are stored in this way as well, but when querying for a non-all-day appointment by start time SharePoint will automatically convert the date-time passed in into UTC. CAML queries for all-day appointments do not behave similarly.

So if you are trying to query a SharePoint calendar list for an all-day appointment using the start time or end time of that appointment, remember to convert the date-time you are passing in into UTC manually. This is not necessary for non-all-day appointments. Also remember to use the exact date-time in question when converting because the offset may be different because of daylight savings' time.