更新预约时,我遇到时区问题。
第1步,创建单个事件,工作正常
首先我创建一个单一事件,从当地时间10:00到11:00(阿姆斯特丹DST,UTC + 2)运行。
我的Exchange Server 2010(SP2)知道" W。欧洲标准时间"时区。
没问题,这里是Outlook 2007中的事件:
这是创建事件的XML:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:CreateItem SendMeetingInvitations="SendToNone">
<mes:SavedItemFolderId>
<typ:DistinguishedFolderId Id="calendar">
<typ:Mailbox>
<typ:EmailAddress>developer@timetellbv.nl</typ:EmailAddress>
</typ:Mailbox>
</typ:DistinguishedFolderId>
</mes:SavedItemFolderId>
<mes:Items>
<typ:CalendarItem>
<typ:Subject>New event 10:00-11:00</typ:Subject>
<typ:Body BodyType="Text"></typ:Body>
<typ:Categories>
<typ:String>TimeTell</typ:String>
</typ:Categories>
<typ:ReminderIsSet>false</typ:ReminderIsSet>
<typ:Start>2014-08-19T10:00:00.000+02:00</typ:Start>
<typ:End>2014-08-19T11:00:00.000+02:00</typ:End>
<typ:IsAllDayEvent>false</typ:IsAllDayEvent>
<typ:LegacyFreeBusyStatus>Busy</typ:LegacyFreeBusyStatus>
<typ:Location></typ:Location>
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
</typ:CalendarItem>
</mes:Items>
</mes:CreateItem>
</soapenv:Body>
</soapenv:Envelope>
请注意,我指定了MeetingTimeZone,并为“开始/结束”指定了显式时区,以便Exchange Server知道如何将其转换为UTC,而不必依赖服务器时区(请参阅Best Practices for Using Exchange Web Services for Calendaring Tasks)。登记/> 我在创建活动时尝试省略所有时区信息,但这立刻给了我雷克雅未克效应&#39;步骤2.无论如何,第1步工作正常。
第2步,更新单个事件,失败:更改Outlook中显示的时区
现在我只修改事件标题;我需要再次指定所有项目(我的代码不知道改变了什么):
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:UpdateItem ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToNone">
<mes:ItemChanges>
<typ:ItemChange>
<typ:ItemId Id="AQMkAZ[snip]hgAAAA==" ChangeKey="DwAAA[snip]yy5AX"/>
<typ:Updates>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Subject"/>
<typ:CalendarItem>
<typ:Subject>New event 10:00-11:00 (modified)</typ:Subject>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Sensitivity"/>
<typ:CalendarItem>
<typ:Sensitivity>Normal</typ:Sensitivity>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Categories"/>
<typ:CalendarItem>
<typ:Categories>
<typ:String>TimeTell</typ:String>
</typ:Categories>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Body"/>
<typ:CalendarItem>
<typ:Body BodyType="Text"></typ:Body>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:Location"/>
<typ:CalendarItem>
<typ:Location></typ:Location>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:ReminderIsSet"/>
<typ:CalendarItem>
<typ:ReminderIsSet>false</typ:ReminderIsSet>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:IsAllDayEvent"/>
<typ:CalendarItem>
<typ:IsAllDayEvent>false</typ:IsAllDayEvent>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:Start"/>
<typ:CalendarItem>
<typ:Start>2014-08-19T10:00:00.000+02:00</typ:Start>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:End"/>
<typ:CalendarItem>
<typ:End>2014-08-19T11:00:00.000+02:00</typ:End>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:LegacyFreeBusyStatus"/>
<typ:CalendarItem>
<typ:LegacyFreeBusyStatus>Busy</typ:LegacyFreeBusyStatus>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellID" PropertyType="Integer"/>
<typ:CalendarItem>
<typ:ExtendedProperty>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellID" PropertyType="Integer"/>
<typ:Value>10722</typ:Value>
</typ:ExtendedProperty>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncTime" PropertyType="SystemTime"/>
<typ:CalendarItem>
<typ:ExtendedProperty>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncTime" PropertyType="SystemTime"/>
<typ:Value>2014-08-19T16:22:22.094+02:00</typ:Value>
</typ:ExtendedProperty>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncVer" PropertyType="Integer"/>
<typ:CalendarItem>
<typ:ExtendedProperty>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncVer" PropertyType="Integer"/>
<typ:Value>80000</typ:Value>
</typ:ExtendedProperty>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncID" PropertyType="String"/>
<typ:CalendarItem>
<typ:ExtendedProperty>
<typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncID" PropertyType="String"/>
<typ:Value>0000000082ADE26393957649AD9C74BF97109BC2070084A6175871FF6A40850053554066620A000000000021000084A6175871FF6A40850053554066620A000232CB43830000</typ:Value>
</typ:ExtendedProperty>
</typ:CalendarItem>
</typ:SetItemField>
</typ:Updates>
</typ:ItemChange>
</mes:ItemChanges>
</mes:UpdateItem>
</soapenv:Body>
</soapenv:Envelope>
但现在我明白了:
该事件在日历概述中正确显示
但是当我打开它时,我突然变得不正确&#39;雷克雅未克&#39;次:
请注意,UpdateItem调用的标头仍然具有
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
但没有
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
调用中的,就像在CreateItem调用中那样。
如果我试图像这样把它放进去,我会收到错误&#34;在商店中找不到指定的对象&#34;:
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:Start"/>
<typ:CalendarItem>
<typ:Start>2014-08-19T10:00:00.000+02:00</typ:Start>
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:End"/>
<typ:CalendarItem>
<typ:End>2014-08-19T11:00:00.000+02:00</typ:End>
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
</typ:CalendarItem>
</typ:SetItemField>
我尝试将MeetingTimeZone放在文件的其他位置,但不断出现语法错误。
将TimeZoneContext从UpdateItem的标头中删除并不能解决问题(根据我在TimeZoneContext documentation中的理解,我应该使用它。)
我需要使用MeetingTimeZone向后兼容Exchange Server 2007 SP1(对于以后的版本,不推荐使用MeetingTimeZone,我们应该使用StartImeZone / EndTimeZone)。
问题:如何更改UpdateItem调用以确保我的Outlook事件保持正确的时间(区域)?
背景资料:
<ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="195" MinorBuildNumber="1" Version="Exchange2010_SP2"/>
本地Outlook设置为阿姆斯特丹时区(由于DST,目前为UTC + 2)。
Here is an EWS Managed API user experiencing similar problems但没有解决方案。
答案 0 :(得分:1)
我明白了!感谢这篇EWS Calendar Recurrence Item Update - TimeZone problem帖子。
确实你不能只插入一个
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
在SOAP请求中的某处,但您还必须将MeetingTimeZone指定为要更改的CalendarItem元素。
因此,必须将此附加项插入到调用中:
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:MeetingTimeZone"/>
<typ:CalendarItem>
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time" />
</typ:CalendarItem>
</typ:SetItemField>
并确保将其放在正确的位置,因为必须按照CalendarItem type
中定义的顺序指定项目