ItemId id=null;
string s = "";
const string dts = " dd.MM.yyyy HH:mm ";
if(true) {
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010, tz);
ews.AutodiscoverUrl("Alexander@contoso.com");
Appointment app = new Appointment(ews);
app.IsAllDayEvent = true;
app.StartTimeZone = tz;
app.EndTimeZone = tz;
app.Start = DateTime.Now;
app.End = DateTime.Now;
app.Save(SendInvitationsMode.SendToNone);
id = app.Id;
Console.WriteLine(app.Start.ToString(dts));
}
if(true) {
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010, tz);
ews.AutodiscoverUrl("Alexander@contoso.com");
Appointment app = Appointment.Bind(ews,id);
Console.WriteLine(app.Start.ToString(dts));
app.IsAllDayEvent = true;
app.StartTimeZone = tz;
app.EndTimeZone = tz;
app.Start = DateTime.Now;
app.End = DateTime.Now;
app.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
Console.WriteLine(app.Start.ToString(dts));
}
if (true)
{
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010, tz);
ews.AutodiscoverUrl("Alexander@contoso.com");
Appointment app = Appointment.Bind(ews, id);
Console.WriteLine(app.Start.ToString(dts));
}
The console output is:
05.05.2014 18:17
05.05.2014 00:00
05.05.2014 18:17
05.05.2014 02:00
So creating a new All-day event works like a charm (which is better than what I had this morning).
But why is the last line 02:00
, and how do I have to rewrite my program to have 00:00 CEST stored as the all-day appointment start date?