tags:

views:

273

answers:

1

I'm trying to get the UTC time of an appointmentItem RecurrencePattern object:

Outlook.RecurrencePattern r = appt.GetRecurrencePattern();
String utcDate = r.StartTime.ToUniversalTime().ToString("yyyy-MM-dd");
MessageBox.Show(utcDate);

Instead of the date I'm expecting (2009-02-05), I instead get 1899-12-30. I noticed the Microsoft help page (http://msdn.microsoft.com/en-us/library/ms526846(EXCHG.10).aspx) says that StartTime is held internally in local date time - does this mean I can't convert to UTC time using this DateTime object? Do I need to access the first appointment item and figure out the recurring appointment series starttime from that?

--- Edit ---

Actually, it seems like r.StartTime itself returns a date in 1899. All the other parameters on the recurrence pattern seem to work fine (except for enddate, which also returns an 1899 date) - shouldn't StartTime default to the same time as the original appt item?

A: 

Still not sure why I can't get the UTC time of the StartTime object, but it turns out it's possible to instead use the StartUTC property of the AppointmentItem object the recurrence pattern is generated from. If a recurring item is opened with the "open series" option, the active AppointmentItem is the first appointment in the series (even if to get there the user clicks on a later appointment item in the series).

remanc