Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All-day events are not created correctly in Office 365

I am trying to export some events to a calendar in Office 365 through their REST API, https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations#EventoperationsCreateevents.

I set the IsAllDay to true, and set the start and end to midnight in UTC.

The payload looks like this:

{
  "Body": {
    "Content": "Agenda",
    "ContentType": "HTML"
  },
  "End": "2015-02-01T00:00:00Z",
  "ShowAs": "Busy",
  "Start": "2015-01-30T00:00:00Z",
  "ChangeKey": "X2+akAeClEa0OJ8r6nC5QgABW30vaQ==",
  "Location": {
    "DisplayName": "Vesterbrogade"
  },
  "Subject": "Updated title",
  "IsAllDay": true
}

That looks fine, and if I GET the event again, the payload comes back as set. However when I go to outlook.office365.com the event now spans 2 days, instead of 1 as intended. The duration however appears as 1 day. Unclicking the "all day" in Outlook reveals the problem. Since I am in Central European Time, I'm one hour ahead of UTC. The start shows as 2015-01-30 01:00 and the end as 2015-02-01 00:59. So underneath the covers it doesn't seem to be stored as an all day event in my timezone.

When you use f.ex. EWS, you normally set the timezone of the meeting, however that doesn't appear to be possible.

I have tried to give the start and end with timezone information, but I get a 400 telling me it has to be supplied in UTC. So as far as I can tell there is nothing I can, expect hope that Microsoft fixes this. Or am I missing something?

EDIT: The event actually appears correctly in Outlook for Mac, so perhaps this is only a problem in the OWA at outlook.office365.com.

like image 495
Christian Holm Avatar asked Mar 11 '15 09:03

Christian Holm


People also ask

How do I make an Outlook event all day?

Create an event Use the calendar drop-down boxes next to Start time and End time to select the date of your event. To turn your appointment into an all day event, check the All day event box.

Why is Outlook 365 time wrong?

In your Outlook client: To change the time zone in Outlook, click on File -> Options -> Calendar settings. In the time zone area, select the new time zone and save. Note: The time zone of Outlook client is the same as your PC. Reload/refresh the ScheduleOnce page to reflect the change.


1 Answers

The API now supports time zones. What you would want to do here is not specify your Start and End as UTC (indicated by the 'Z' prefix on the end), but instead specify it in your time zone. You would then set the StartTimeZone and EndTimeZone values to "Central European Time". So something like this:

{
  "Body": {
    "Content": "Agenda",
    "ContentType": "HTML"
  },
  "Start": "2015-01-30T00:00:00+01:00",
  "End": "2015-02-01T00:00:00+01:00",
  "ShowAs": "Busy",
  "Location": {
    "DisplayName": "Vesterbrogade"
  },
  "Subject": "Updated title",
  "IsAllDay": true,
  "StartTimeZone": "Central European Standard Time",
  "EndTimeZone": "Central European Standard Time"
}
like image 95
Jason Johnston Avatar answered Oct 04 '22 20:10

Jason Johnston