1

我正在使用库PHP EWS通过EWS在 Exchange (2010) 中创建日历事件。

当我创建一个事件时,我设置了开始和结束日期时间以及时区。发送的 XML 如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages">
    <SOAP-ENV:Header>
        <ns1:RequestServerVersion Version="Exchange2010"/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns2:CreateItem SendMeetingInvitations="SendToNone">
            <ns2:Items>
                <ns1:CalendarItem>
                    <ns1:ItemClass>IPM.Appointment</ns1:ItemClass>
                    <ns1:Subject>aa</ns1:Subject>
                    <ns1:Sensitivity>Normal</ns1:Sensitivity>
                    <ns1:Body BodyType="HTML">aa</ns1:Body>
                    <ns1:Categories>
                        <ns1:String>Afspraak</ns1:String>
                    </ns1:Categories>
                    <ns1:Importance>Normal</ns1:Importance>
                    <ns1:ReminderIsSet>false</ns1:ReminderIsSet>
                    <ns1:Start>2015-10-06T22:00:00</ns1:Start>
                    <ns1:End>2015-10-06T22:00:00</ns1:End>
                    <ns1:IsAllDayEvent>true</ns1:IsAllDayEvent>
                    <ns1:LegacyFreeBusyStatus>Free</ns1:LegacyFreeBusyStatus>
                    <ns1:StartTimeZone Id="W. Europe Standard Time">
                        <ns1:Periods>
                            <ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/>
                            <ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/>
                        </ns1:Periods>
                        <ns1:TransitionsGroups>
                            <ns1:TransitionsGroup Id="0">
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight</ns1:To>
                                    <ns1:TimeOffset>PT2H</ns1:TimeOffset>
                                    <ns1:Month>3</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Standard</ns1:To>
                                    <ns1:TimeOffset>PT3H</ns1:TimeOffset>
                                    <ns1:Month>10</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                            </ns1:TransitionsGroup>
                        </ns1:TransitionsGroups>
                        <ns1:Transitions>
                            <ns1:Transition>
                                <ns1:To Kind="Group">0</ns1:To>
                            </ns1:Transition>
                        </ns1:Transitions>
                    </ns1:StartTimeZone>
                    <ns1:EndTimeZone Id="W. Europe Standard Time">
                        <ns1:Periods>
                            <ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/>
                            <ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/>
                        </ns1:Periods>
                        <ns1:TransitionsGroups>
                            <ns1:TransitionsGroup Id="0">
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight</ns1:To>
                                    <ns1:TimeOffset>PT2H</ns1:TimeOffset>
                                    <ns1:Month>3</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Standard</ns1:To>
                                    <ns1:TimeOffset>PT3H</ns1:TimeOffset>
                                    <ns1:Month>10</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                            </ns1:TransitionsGroup>
                        </ns1:TransitionsGroups>
                        <ns1:Transitions>
                            <ns1:Transition>
                                <ns1:To Kind="Group">0</ns1:To>
                            </ns1:Transition>
                        </ns1:Transitions>
                    </ns1:EndTimeZone>
                </ns1:CalendarItem>
            </ns2:Items>
        </ns2:CreateItem>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这很完美。但是,当我添加与会者并更改SendMeetingInvitations为时SendOnlyToAll,由于某种原因,Exchange 更改了日期和时间。发送的 XML 如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages">
    <SOAP-ENV:Header>
        <ns1:RequestServerVersion Version="Exchange2010"/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns2:CreateItem SendMeetingInvitations="SendOnlyToAll">
            <ns2:Items>
                <ns1:CalendarItem>
                    <ns1:ItemClass>IPM.Appointment</ns1:ItemClass>
                    <ns1:Subject>aa</ns1:Subject>
                    <ns1:Sensitivity>Normal</ns1:Sensitivity>
                    <ns1:Body BodyType="HTML">aa</ns1:Body>
                    <ns1:Categories>
                        <ns1:String>Afspraak</ns1:String>
                    </ns1:Categories>
                    <ns1:Importance>Normal</ns1:Importance>
                    <ns1:ReminderIsSet>false</ns1:ReminderIsSet>
                    <ns1:Start>2015-10-06T22:00:00</ns1:Start>
                    <ns1:End>2015-10-06T22:00:00</ns1:End>
                    <ns1:IsAllDayEvent>true</ns1:IsAllDayEvent>
                    <ns1:LegacyFreeBusyStatus>Free</ns1:LegacyFreeBusyStatus>
                    <ns1:RequiredAttendees>
                        <ns1:Attendee>
                            <ns1:Mailbox>
                                <ns1:EmailAddress>some@email.com</ns1:EmailAddress>
                                <ns1:RoutingType>SMTP</ns1:RoutingType>
                            </ns1:Mailbox>
                        </ns1:Attendee>
                    </ns1:RequiredAttendees>
                    <ns1:StartTimeZone Id="W. Europe Standard Time">
                        <ns1:Periods>
                            <ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/>
                            <ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/>
                        </ns1:Periods>
                        <ns1:TransitionsGroups>
                            <ns1:TransitionsGroup Id="0">
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight</ns1:To>
                                    <ns1:TimeOffset>PT2H</ns1:TimeOffset>
                                    <ns1:Month>3</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Standard</ns1:To>
                                    <ns1:TimeOffset>PT3H</ns1:TimeOffset>
                                    <ns1:Month>10</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                            </ns1:TransitionsGroup>
                        </ns1:TransitionsGroups>
                        <ns1:Transitions>
                            <ns1:Transition>
                                <ns1:To Kind="Group">0</ns1:To>
                            </ns1:Transition>
                        </ns1:Transitions>
                    </ns1:StartTimeZone>
                    <ns1:EndTimeZone Id="W. Europe Standard Time">
                        <ns1:Periods>
                            <ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/>
                            <ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/>
                        </ns1:Periods>
                        <ns1:TransitionsGroups>
                            <ns1:TransitionsGroup Id="0">
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight</ns1:To>
                                    <ns1:TimeOffset>PT2H</ns1:TimeOffset>
                                    <ns1:Month>3</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                                <ns1:RecurringDayTransition>
                                    <ns1:To Kind="Period">trule:Microsoft/Registry/W. Europe Standard Time/1-Standard</ns1:To>
                                    <ns1:TimeOffset>PT3H</ns1:TimeOffset>
                                    <ns1:Month>10</ns1:Month>
                                    <ns1:DayOfWeek>Sunday</ns1:DayOfWeek>
                                    <ns1:Occurrence>-1</ns1:Occurrence>
                                </ns1:RecurringDayTransition>
                            </ns1:TransitionsGroup>
                        </ns1:TransitionsGroups>
                        <ns1:Transitions>
                            <ns1:Transition>
                                <ns1:To Kind="Group">0</ns1:To>
                            </ns1:Transition>
                        </ns1:Transitions>
                    </ns1:EndTimeZone>
                </ns1:CalendarItem>
            </ns2:Items>
        </ns2:CreateItem>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

如您所见,两种情况下的开始日期时间和结束日期时间相同,但是在 Outlook 中查看事件时,它们是不同的: 事件差异

(我的 Outlook 的时区为 UTC+01:00)

一个事件以正确的日期/时间显示,但另一个事件的开始日期为 2015 年 6 月 10 日 02:00,结束日期为 2015 年 8 月 10 日 02:00。

为什么是这样?更重要的是如何解决这个问题

注意:这只发生在IsAllDayEventis时true。如果它不是全天事件,则它是正确创建的。

4

0 回答 0