title: EWS SendMeetingInvitations property changes date and time
body: <p>I'm creating calendar events in Exchange (2010) via <a href="https://msdn.microsoft.com/en-us/library/office/dd877045%28v=exchg.140%29.aspx" rel="nofollow noreferrer">EWS</a> using the library <a href="https://github.com/jamesiarmes/php-ews" rel="nofollow noreferrer">PHP EWS</a>.</p>
  
  <p>When i create an event i set the start and end datetimes and the timezone. The XML that is sent looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
      &lt;SOAP-ENV:Header&gt;
          &lt;ns1:RequestServerVersion Version="Exchange2010"/&gt;
      &lt;/SOAP-ENV:Header&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns2:CreateItem SendMeetingInvitations="SendToNone"&gt;
              &lt;ns2:Items&gt;
                  &lt;ns1:CalendarItem&gt;
                      &lt;ns1:ItemClass&gt;IPM.Appointment&lt;/ns1:ItemClass&gt;
                      &lt;ns1:Subject&gt;aa&lt;/ns1:Subject&gt;
                      &lt;ns1:Sensitivity&gt;Normal&lt;/ns1:Sensitivity&gt;
                      &lt;ns1:Body BodyType="HTML"&gt;aa&lt;/ns1:Body&gt;
                      &lt;ns1:Categories&gt;
                          &lt;ns1:String&gt;Afspraak&lt;/ns1:String&gt;
                      &lt;/ns1:Categories&gt;
                      &lt;ns1:Importance&gt;Normal&lt;/ns1:Importance&gt;
                      &lt;ns1:ReminderIsSet&gt;false&lt;/ns1:ReminderIsSet&gt;
                      &lt;ns1:Start&gt;2015-10-06T22:00:00&lt;/ns1:Start&gt;
                      &lt;ns1:End&gt;2015-10-06T22:00:00&lt;/ns1:End&gt;
                      &lt;ns1:IsAllDayEvent&gt;true&lt;/ns1:IsAllDayEvent&gt;
                      &lt;ns1:LegacyFreeBusyStatus&gt;Free&lt;/ns1:LegacyFreeBusyStatus&gt;
                      &lt;ns1:StartTimeZone Id="W. Europe Standard Time"&gt;
                          &lt;ns1:Periods&gt;
                              &lt;ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/&gt;
                              &lt;ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/&gt;
                          &lt;/ns1:Periods&gt;
                          &lt;ns1:TransitionsGroups&gt;
                              &lt;ns1:TransitionsGroup Id="0"&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT2H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;3&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Standard&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT3H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;10&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                              &lt;/ns1:TransitionsGroup&gt;
                          &lt;/ns1:TransitionsGroups&gt;
                          &lt;ns1:Transitions&gt;
                              &lt;ns1:Transition&gt;
                                  &lt;ns1:To Kind="Group"&gt;0&lt;/ns1:To&gt;
                              &lt;/ns1:Transition&gt;
                          &lt;/ns1:Transitions&gt;
                      &lt;/ns1:StartTimeZone&gt;
                      &lt;ns1:EndTimeZone Id="W. Europe Standard Time"&gt;
                          &lt;ns1:Periods&gt;
                              &lt;ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/&gt;
                              &lt;ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/&gt;
                          &lt;/ns1:Periods&gt;
                          &lt;ns1:TransitionsGroups&gt;
                              &lt;ns1:TransitionsGroup Id="0"&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT2H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;3&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Standard&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT3H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;10&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                              &lt;/ns1:TransitionsGroup&gt;
                          &lt;/ns1:TransitionsGroups&gt;
                          &lt;ns1:Transitions&gt;
                              &lt;ns1:Transition&gt;
                                  &lt;ns1:To Kind="Group"&gt;0&lt;/ns1:To&gt;
                              &lt;/ns1:Transition&gt;
                          &lt;/ns1:Transitions&gt;
                      &lt;/ns1:EndTimeZone&gt;
                  &lt;/ns1:CalendarItem&gt;
              &lt;/ns2:Items&gt;
          &lt;/ns2:CreateItem&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>This works perfect. However, when i add attendees and change <code>SendMeetingInvitations</code> to <code>SendOnlyToAll</code>, for some reason, Exchange changes the date and time. The XML that is sent looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
      &lt;SOAP-ENV:Header&gt;
          &lt;ns1:RequestServerVersion Version="Exchange2010"/&gt;
      &lt;/SOAP-ENV:Header&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns2:CreateItem SendMeetingInvitations="SendOnlyToAll"&gt;
              &lt;ns2:Items&gt;
                  &lt;ns1:CalendarItem&gt;
                      &lt;ns1:ItemClass&gt;IPM.Appointment&lt;/ns1:ItemClass&gt;
                      &lt;ns1:Subject&gt;aa&lt;/ns1:Subject&gt;
                      &lt;ns1:Sensitivity&gt;Normal&lt;/ns1:Sensitivity&gt;
                      &lt;ns1:Body BodyType="HTML"&gt;aa&lt;/ns1:Body&gt;
                      &lt;ns1:Categories&gt;
                          &lt;ns1:String&gt;Afspraak&lt;/ns1:String&gt;
                      &lt;/ns1:Categories&gt;
                      &lt;ns1:Importance&gt;Normal&lt;/ns1:Importance&gt;
                      &lt;ns1:ReminderIsSet&gt;false&lt;/ns1:ReminderIsSet&gt;
                      &lt;ns1:Start&gt;2015-10-06T22:00:00&lt;/ns1:Start&gt;
                      &lt;ns1:End&gt;2015-10-06T22:00:00&lt;/ns1:End&gt;
                      &lt;ns1:IsAllDayEvent&gt;true&lt;/ns1:IsAllDayEvent&gt;
                      &lt;ns1:LegacyFreeBusyStatus&gt;Free&lt;/ns1:LegacyFreeBusyStatus&gt;
                      &lt;ns1:RequiredAttendees&gt;
                          &lt;ns1:Attendee&gt;
                              &lt;ns1:Mailbox&gt;
                                  &lt;ns1:EmailAddress&gt;some@email.com&lt;/ns1:EmailAddress&gt;
                                  &lt;ns1:RoutingType&gt;SMTP&lt;/ns1:RoutingType&gt;
                              &lt;/ns1:Mailbox&gt;
                          &lt;/ns1:Attendee&gt;
                      &lt;/ns1:RequiredAttendees&gt;
                      &lt;ns1:StartTimeZone Id="W. Europe Standard Time"&gt;
                          &lt;ns1:Periods&gt;
                              &lt;ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/&gt;
                              &lt;ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/&gt;
                          &lt;/ns1:Periods&gt;
                          &lt;ns1:TransitionsGroups&gt;
                              &lt;ns1:TransitionsGroup Id="0"&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT2H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;3&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Standard&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT3H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;10&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                              &lt;/ns1:TransitionsGroup&gt;
                          &lt;/ns1:TransitionsGroups&gt;
                          &lt;ns1:Transitions&gt;
                              &lt;ns1:Transition&gt;
                                  &lt;ns1:To Kind="Group"&gt;0&lt;/ns1:To&gt;
                              &lt;/ns1:Transition&gt;
                          &lt;/ns1:Transitions&gt;
                      &lt;/ns1:StartTimeZone&gt;
                      &lt;ns1:EndTimeZone Id="W. Europe Standard Time"&gt;
                          &lt;ns1:Periods&gt;
                              &lt;ns1:Period Bias="-PT1H" Name="Standard" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Standard"/&gt;
                              &lt;ns1:Period Bias="-PT2H" Name="Daylight" Id="trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight"/&gt;
                          &lt;/ns1:Periods&gt;
                          &lt;ns1:TransitionsGroups&gt;
                              &lt;ns1:TransitionsGroup Id="0"&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Daylight&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT2H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;3&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                                  &lt;ns1:RecurringDayTransition&gt;
                                      &lt;ns1:To Kind="Period"&gt;trule:Microsoft/Registry/W. Europe Standard Time/1-Standard&lt;/ns1:To&gt;
                                      &lt;ns1:TimeOffset&gt;PT3H&lt;/ns1:TimeOffset&gt;
                                      &lt;ns1:Month&gt;10&lt;/ns1:Month&gt;
                                      &lt;ns1:DayOfWeek&gt;Sunday&lt;/ns1:DayOfWeek&gt;
                                      &lt;ns1:Occurrence&gt;-1&lt;/ns1:Occurrence&gt;
                                  &lt;/ns1:RecurringDayTransition&gt;
                              &lt;/ns1:TransitionsGroup&gt;
                          &lt;/ns1:TransitionsGroups&gt;
                          &lt;ns1:Transitions&gt;
                              &lt;ns1:Transition&gt;
                                  &lt;ns1:To Kind="Group"&gt;0&lt;/ns1:To&gt;
                              &lt;/ns1:Transition&gt;
                          &lt;/ns1:Transitions&gt;
                      &lt;/ns1:EndTimeZone&gt;
                  &lt;/ns1:CalendarItem&gt;
              &lt;/ns2:Items&gt;
          &lt;/ns2:CreateItem&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>As you can see, the start and end datetime is the same in both situations, however when viewing the events in Outlook, they are different:
  <a href="https://i.stack.imgur.com/DbNif.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DbNif.png" alt="event difference"></a></p>
  
  <p>(My Outlook has the timezone UTC+01:00)</p>
  
  <p>One event is shown in the correct date/time, but the other somehow has a start date of 6-10-2015 02:00 and an end date of 8-10-2015 02:00.</p>
  
  <p>Why is this? And more importantly <strong>how does one solve this issue</strong>?</p>
  
  <p>Note: This only happens when <code>IsAllDayEvent</code> is <code>true</code>. If it is not an all day event it is created correctly.</p>