简体   繁体   English

如何为Outlook约会设置时区(通过EWS API创建时)

[英]How to Set Timezone for Outlook Appointment.When if created via EWS API

We are using Exchange Web Services API to create the Appointment. 我们正在使用Exchange Web服务API创建约会。 We set the timezone to local timezone during creation. 在创建过程中,我们将时区设置为本地时区。 When recipients view the invite, it is the right time at his local timezone, the only thing is that Exchange adds "When" and "Where" at the beginning of appointment body like this: 收件人查看邀请时,是在当地时区的正确时间,唯一的事情是Exchange会在约会正文的开头添加“ When”和“ Where”,如下所示:

约定

The timezone for When is always in UTC timezone no matter what end user's timezone is. 无论何时最终用户的时区,“何时”的时区始终处于UTC时区。 This causes some confusion for end users of our customers. 这给我们客户的最终用户造成了一些困惑。 From EWS API Document for Appointment.When property, there is only Get method, not Set method. EWS API的约会文档中。当属性为时 ,只有Get方法,而没有Set方法。 In one test, we tried to set the Preferred culture to de-de culture as document is suggested and "When" is still displayed in UTC time. 在一项测试中,我们尝试根据建议的文档将“首选区域性”设置为“删除区域性”,并且仍在UTC时间显示“何时”。 设定首选文化

Somehow I could not find any related information on this over the internet. 不知何故,我在互联网上找不到任何相关信息。 Could anyone shed some lights here about how to have "When" to be displayed in certain timezone? 有人可以在这里阐明如何在特定时区显示“何时”吗?

What your looking at is referred to as downlevel text in the Message body, the issue generally occurs during an update of the appointment which you seem to be doing as the last line of the image you posted. 您所查看的内容在消息正文中被称为下级文本,该问题通常发生在约会的更新过程中,您似乎将其作为发布图像的最后一行。 The problem is because the timezone doesn't get sent as part of the update request the server will set the downlevel text to utc. 问题是因为未将时区作为更新请求的一部分发送,服务器会将下层文本设置为utc。 One work around for this is you can add the TimeZoneContext header manually using 解决此问题的一种方法是,您可以使用手动添加TimeZoneContext标头

OnSerializeCustomSoapHeaders event eg OnSerializeCustomSoapHeaders事件,例如

        service.OnSerializeCustomSoapHeaders += service_OnSerializeCustomSoapHeaders;
        appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);
        service.OnSerializeCustomSoapHeaders -= service_OnSerializeCustomSoapHeaders;

    static void service_OnSerializeCustomSoapHeaders(XmlWriter writer)
    {
        writer.WriteRaw(Environment.NewLine + "    <t:TimeZoneContext><t:TimeZoneDefinition Id=\"" + TimeZone.CurrentTimeZone.StandardName + "\"/></t:TimeZoneContext>" + Environment.NewLine);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM