EWS SendMeetingInvitations属性更改日期和时间

时间:2015-10-08 08:18:04

标签: php exchangewebservices exchange-server-2010 outlook-2003 php-ews

我正在使用库EWS通过PHP 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中查看事件时,它们是不同的: event difference

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

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

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

注意:仅当IsAllDayEventtrue时才会发生这种情况。如果它不是全天事件,则会正确创建。

0 个答案:

没有答案