全天事件,时区和更新
本文关键字:更新 时区 事件 | 更新日期: 2023-09-27 18:01:41
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));
}
控制台输出为:
05.05.2014 18:17
05.05.2014 00:00
05.05.2014 18:17
05.05.2014 02:00
所以创建一个新的全天活动就像一个魅力(这比我今天早上的要好)。
但是为什么最后一行是02:00
,以及我如何重写我的程序以将00:00 CEST存储为全天约会开始日期?
我不是开发人员,但正在为我们的(Java)开发人员调查这个问题。看起来你必须从最初的约会中获得所有时区s,否则你会遇到这个问题…在下面的参考文献/其他堆栈溢出问题中,第5个问题得到了它,这是我找到的最后一个问题:(
- 你和问这个问题的人处于同一阶段
- 更接近一步,实际时间是正确的,但是会议显示错误的时区
- 类似的问题没有答案
- 回答了这些版本,但我不知道它是什么意思:Exchange Server 2007 Service Pack 1 (SP1)/Exchange Server 2010
- 这个实际上让它工作正确。参考这个答案在微软论坛
如果这对某些人有帮助,也许其他人也可以最终关闭:)