I have trouble creating a bi-weekly calendar appointment in Exchange or viewing it in Outlook
The event is bi-weekly (interval=2) on Saturday and Sunday, starting 19 Jan 2013, with a maximum of 5 occurences.
Expected occurrences: sat 19 jan, sun 20 jan, sat 2 feb, sun 3 feb, sat 16 feb
Observed occurrences: sat 19 jan, sun 27 jan, sat 2 feb, sun 10 feb, sat 16 feb. Whaaat??
I look at the appointment with Outlook 2003 SP3 or Outlook 2010 (SP?).
This is the code that created the event with Exchange Web Services, with comments about things I tried:
<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 makes no difference -->
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"></typ:TimeZoneDefinition>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:CreateItem SendMeetingInvitations="SendToNone">
<mes:Items>
<typ:CalendarItem>
<typ:Subject>Every 2 weeks sa/su, ends after 5</typ:Subject>
<typ:Body BodyType="Text"></typ:Body>
<typ:ReminderIsSet>false</typ:ReminderIsSet>
<typ:Start>2013-01-19T11:00:00.000+01:00</typ:Start>
<typ:End>2013-01-19T11:30:00.000+01:00</typ:End>
<typ:IsAllDayEvent>false</typ:IsAllDayEvent>
<typ:LegacyFreeBusyStatus>Busy</typ:LegacyFreeBusyStatus>
<typ:Location></typ:Location>
<typ:Recurrence>
<typ:WeeklyRecurrence>
<typ:Interval>2</typ:Interval>
<!-- Day name order makes no difference -->
<typ:DaysOfWeek>Saturday Sunday</typ:DaysOfWeek>
<!-- typ:FirstDayOfWeek>Sunday</typ:FirstDayOfWeek Tried but not allowed in Exchange2007_SP1 or Exchange2010-->
</typ:WeeklyRecurrence>
<typ:NumberedRecurrence>
<typ:StartDate>2013-01-19</typ:StartDate>
<typ:NumberOfOccurrences>5</typ:NumberOfOccurrences>
</typ:NumberedRecurrence>
<!-- MeetingTimeZone makes no difference -->
<typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
</typ:Recurrence>
</typ:CalendarItem>
</mes:Items>
</mes:CreateItem>
</soapenv:Body>
</soapenv:Envelope>
This code is practically identical to Listing 9-29 of the book Inside Microsoft Exchange Server 2007 Web Services by David Sterling et al
If I query EWS for this event I get back what I created:
<t:CalendarItem>
<t:ItemId Id="AQMkA[snip]PYb1"/>
<t:Subject>Every 2 weeks sa/su, ends after 5</t:Subject>
[snip]
<t:Start>2013-01-19T10:00:00Z</t:Start>
<t:End>2013-01-19T10:30:00Z</t:End>
<t:CalendarItemType>RecurringMaster</t:CalendarItemType>
<t:Recurrence>
<t:WeeklyRecurrence>
<t:Interval>2</t:Interval>
<t:DaysOfWeek>Sunday Saturday</t:DaysOfWeek>
</t:WeeklyRecurrence>
<t:NumberedRecurrence>
<t:StartDate>2013-01-19+01:00</t:StartDate>
<t:NumberOfOccurrences>5</t:NumberOfOccurrences>
</t:NumberedRecurrence>
</t:Recurrence>
</t:CalendarItem>
This is Exchange server 2010 no service packs.
Other things I tried:
1) If I edit that mystery event in Outlook and tell it to occur on Fridays as well, it gets updated more or less properly: one Friday occurs extra (1 Feb) and the last Sat 16 Feb event drops off, but my alternating sat/sun occurrences remain
2) With the same code in EWS I created this event for:
Tuesday Thursday (startdate 15 jan): fine
Sunday Tuesday (startdate 15 jan): wrong (the alternating pattern again)
Monday Saturday (startdate 14 jan): fine
3) Create exactly the same event in Outlook 2003 instead of through EWS. It shows fine. Then query EWS and I get exactly the same SOAP result.
My concern is:
Am I misinterpreting the recurrence parameters or are all Outlook versions wrong? The latter seems unlikely, but the above points to it.
Anyone ideas what could be going wrong here?
I just found out it is a first-day-of week issue.
My Outlook was set to have Monday as first day of week.
If I create the bi-weekly sat-sun appointment in Outlook, the occurrences are as expected:
Now I set Outlook to have Sunday as the first day of the week. Then I get:
The ‘reasoning’ here is:
– there is one opportunity for the sat/sun occurence in this week: 19 Jan
– jump two weeks
– allocate the next sat/sun in that week
– etc
When creating my appointment through SOAP, Exchange server was assuming Sunday as start of the week, and creating the occurrences from the second example.
But when displaying this in an Outlook with Monday as the start of the week, we get:
So ‘all’ I have to do is tell EWS that I’m making the appointment based on Monday as first day of week.
It cannot be set in the WeeklyRecurrence node
It looks as if it can be read and set through the user configuration.
Which leads to the next question: How can I read the entire calendar user configuration in Exchange Web Services?