none
Calendar: Incorrect LastOccurrence Property RRS feed

  • Question

  • Hi,

    I have been writing an EWS integration specifically looking to sync calendars with my application. After reading the documentation, I have noticed that there looks to be an off-by-one error in the recurrence properties when requesting a RecurringMaster calendar item type. 

    Here's the calendar, as created within the Calendar app of Windows 10. The appointment of interest, named Exceptions, runs every weekday from Feb. 1st to the 21st.

    

    Here is my soap request:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
        <t:RequestServerVersion Version="Exchange2015" />
      </soap:Header>
      <soap:Body>
        <m:GetItem>
          <m:ItemShape>
            <t:BaseShape>IdOnly</t:BaseShape>
            <t:AdditionalProperties>
              <t:FieldURI FieldURI="item:ItemId" />
              <t:FieldURI FieldURI="item:Subject" />
              <t:FieldURI FieldURI="calendar:RequiredAttendees" />
              <t:FieldURI FieldURI="calendar:OptionalAttendees" />
              <t:FieldURI FieldURI="calendar:Organizer" />
              <t:FieldURI FieldURI="calendar:CalendarItemType" />
              <t:FieldURI FieldURI="calendar:OriginalStart" />
              <t:FieldURI FieldURI="calendar:Start" />
              <t:FieldURI FieldURI="calendar:End" />
              <t:FieldURI FieldURI="calendar:Location" />
              <t:FieldURI FieldURI="calendar:IsAllDayEvent" />
              <t:FieldURI FieldURI="calendar:TimeZone" />
              <t:FieldURI FieldURI="calendar:StartTimeZone" />
              <t:FieldURI FieldURI="calendar:IsCancelled" />
              <t:FieldURI FieldURI="calendar:Recurrence" />
              <t:FieldURI FieldURI="calendar:FirstOccurrence" />
              <t:FieldURI FieldURI="calendar:LastOccurrence" />
              <t:FieldURI FieldURI="calendar:ModifiedOccurrences" />
              <t:FieldURI FieldURI="calendar:DeletedOccurrences" />
            </t:AdditionalProperties>
          </m:ItemShape>
          <m:ItemIds>
            <t:ItemId Id="[snip]" />
          </m:ItemIds>
        </m:GetItem>
      </soap:Body>
    </soap:Envelope>

    Below is the response I am receiving from EWS. The properties t:EndDateRecurrence and t:LastOccurrence both point to the occurrence on February 20th whereas the last occurrence is actually on the 21st. I also would expect to see the exception on the 21st to be found within the t:ModifiedOccurrences object as its t:Subject has been modified.

    <?xml version="1.0" encoding="UTF-8"?>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Header>
          <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="1" MajorBuildNumber="1415" MinorBuildNumber="2" Version="V2017_07_11" />
       </s:Header>
       <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <m:GetItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
             <m:ResponseMessages>
                <m:GetItemResponseMessage ResponseClass="Success">
                   <m:ResponseCode>NoError</m:ResponseCode>
                   <m:Items>
                      <t:CalendarItem>
                         <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                         <t:Subject>Exceptions</t:Subject>
                         <t:Start>2019-02-01T13:30:00Z</t:Start>
                         <t:End>2019-02-01T14:00:00Z</t:End>
                         <t:IsAllDayEvent>false</t:IsAllDayEvent>
                         <t:Location />
                         <t:IsCancelled>false</t:IsCancelled>
                         <t:CalendarItemType>RecurringMaster</t:CalendarItemType>
                         <t:Organizer>
                            <t:Mailbox>
                               <t:Name>Chris Ashton</t:Name>
                               <t:EmailAddress>chris@corp.contoso.com</t:EmailAddress>
                               <t:RoutingType>SMTP</t:RoutingType>
                               <t:MailboxType>Mailbox</t:MailboxType>
                            </t:Mailbox>
                         </t:Organizer>
                         <t:RequiredAttendees>
                            <t:Attendee>
                               <t:Mailbox>
                                  <t:Name>david.nichols@test.com</t:Name>
                                  <t:EmailAddress>david.nichols@test.com</t:EmailAddress>
                                  <t:RoutingType>SMTP</t:RoutingType>
                                  <t:MailboxType>OneOff</t:MailboxType>
                               </t:Mailbox>
                               <t:ResponseType>Unknown</t:ResponseType>
                            </t:Attendee>
                         </t:RequiredAttendees>
                         <t:TimeZone>(UTC-05:00) Eastern Time (US &amp; Canada)</t:TimeZone>
                         <t:Recurrence>
                            <t:WeeklyRecurrence>
                               <t:Interval>1</t:Interval>
                               <t:DaysOfWeek>Monday Tuesday Wednesday Thursday Friday</t:DaysOfWeek>
                               <t:FirstDayOfWeek>Sunday</t:FirstDayOfWeek>
                            </t:WeeklyRecurrence>
                            <t:EndDateRecurrence>
                               <t:StartDate>2019-02-01-05:00</t:StartDate>
                               <t:EndDate>2019-02-20-05:00</t:EndDate>
                            </t:EndDateRecurrence>
                         </t:Recurrence>
                         <t:FirstOccurrence>
                            <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                            <t:Start>2019-02-01T13:30:00Z</t:Start>
                            <t:End>2019-02-01T14:00:00Z</t:End>
                            <t:OriginalStart>2019-02-01T13:30:00Z</t:OriginalStart>
                         </t:FirstOccurrence>
                         <t:LastOccurrence>
                            <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                            <t:Start>2019-02-20T13:30:00Z</t:Start>
                            <t:End>2019-02-20T14:00:00Z</t:End>
                            <t:OriginalStart>2019-02-20T13:30:00Z</t:OriginalStart>
                         </t:LastOccurrence>
                         <t:ModifiedOccurrences>
                            <t:Occurrence>
                               <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                               <t:Start>2019-02-04T15:30:00Z</t:Start>
                               <t:End>2019-02-04T16:00:00Z</t:End>
                               <t:OriginalStart>2019-02-04T13:30:00Z</t:OriginalStart>
                            </t:Occurrence>
                            <t:Occurrence>
                               <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                               <t:Start>2019-02-06T13:30:00Z</t:Start>
                               <t:End>2019-02-06T14:00:00Z</t:End>
                               <t:OriginalStart>2019-02-06T13:30:00Z</t:OriginalStart>
                            </t:Occurrence>
                            <t:Occurrence>
                               <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                               <t:Start>2019-02-08T13:30:00Z</t:Start>
                               <t:End>2019-02-08T14:00:00Z</t:End>
                               <t:OriginalStart>2019-02-08T13:30:00Z</t:OriginalStart>
                            </t:Occurrence>
                            <t:Occurrence>
                               <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                               <t:Start>2019-02-11T13:30:00Z</t:Start>
                               <t:End>2019-02-11T14:00:00Z</t:End>
                               <t:OriginalStart>2019-02-11T13:30:00Z</t:OriginalStart>
                            </t:Occurrence>
                            <t:Occurrence>
                               <t:ItemId Id="[snip]" ChangeKey="[snip]" />
                               <t:Start>2019-02-18T13:30:00Z</t:Start>
                               <t:End>2019-02-18T14:00:00Z</t:End>
                               <t:OriginalStart>2019-02-18T13:30:00Z</t:OriginalStart>
                            </t:Occurrence>
                         </t:ModifiedOccurrences>
                         <t:DeletedOccurrences>
                            <t:DeletedOccurrence>
                               <t:Start>2019-02-05T13:30:00Z</t:Start>
                            </t:DeletedOccurrence>
                         </t:DeletedOccurrences>
                         <t:StartTimeZone Name="(UTC-05:00) Eastern Time (US &amp; Canada)" Id="Eastern Standard Time">
                            <t:Periods>
                               <t:Period Bias="PT5H" Name="Standard" Id="trule:Microsoft/Registry/Eastern Standard Time/1-Standard" />
                               <t:Period Bias="PT4H" Name="Daylight" Id="trule:Microsoft/Registry/Eastern Standard Time/1-Daylight" />
                               <t:Period Bias="PT5H" Name="Standard" Id="trule:Microsoft/Registry/Eastern Standard Time/2007-Standard" />
                               <t:Period Bias="PT4H" Name="Daylight" Id="trule:Microsoft/Registry/Eastern Standard Time/2007-Daylight" />
                            </t:Periods>
                            <t:TransitionsGroups>
                               <t:TransitionsGroup Id="0">
                                  <t:RecurringDayTransition>
                                     <t:To Kind="Period">trule:Microsoft/Registry/Eastern Standard Time/1-Daylight</t:To>
                                     <t:TimeOffset>PT2H</t:TimeOffset>
                                     <t:Month>4</t:Month>
                                     <t:DayOfWeek>Sunday</t:DayOfWeek>
                                     <t:Occurrence>1</t:Occurrence>
                                  </t:RecurringDayTransition>
                                  <t:RecurringDayTransition>
                                     <t:To Kind="Period">trule:Microsoft/Registry/Eastern Standard Time/1-Standard</t:To>
                                     <t:TimeOffset>PT2H</t:TimeOffset>
                                     <t:Month>10</t:Month>
                                     <t:DayOfWeek>Sunday</t:DayOfWeek>
                                     <t:Occurrence>-1</t:Occurrence>
                                  </t:RecurringDayTransition>
                               </t:TransitionsGroup>
                               <t:TransitionsGroup Id="1">
                                  <t:RecurringDayTransition>
                                     <t:To Kind="Period">trule:Microsoft/Registry/Eastern Standard Time/2007-Daylight</t:To>
                                     <t:TimeOffset>PT2H</t:TimeOffset>
                                     <t:Month>3</t:Month>
                                     <t:DayOfWeek>Sunday</t:DayOfWeek>
                                     <t:Occurrence>2</t:Occurrence>
                                  </t:RecurringDayTransition>
                                  <t:RecurringDayTransition>
                                     <t:To Kind="Period">trule:Microsoft/Registry/Eastern Standard Time/2007-Standard</t:To>
                                     <t:TimeOffset>PT2H</t:TimeOffset>
                                     <t:Month>11</t:Month>
                                     <t:DayOfWeek>Sunday</t:DayOfWeek>
                                     <t:Occurrence>1</t:Occurrence>
                                  </t:RecurringDayTransition>
                               </t:TransitionsGroup>
                            </t:TransitionsGroups>
                            <t:Transitions>
                               <t:Transition>
                                  <t:To Kind="Group">0</t:To>
                               </t:Transition>
                               <t:AbsoluteDateTransition>
                                  <t:To Kind="Group">1</t:To>
                                  <t:DateTime>2007-01-01T00:00:00</t:DateTime>
                               </t:AbsoluteDateTransition>
                            </t:Transitions>
                         </t:StartTimeZone>
                      </t:CalendarItem>
                   </m:Items>
                </m:GetItemResponseMessage>
             </m:ResponseMessages>
          </m:GetItemResponse>
       </s:Body>
    </s:Envelope>

    Am I doing something wrong here? 

    Tuesday, February 5, 2019 1:19 PM