在 Office 365 中未正确创建全天事件 [英] All-day events are not created correctly in Office 365

查看:26
本文介绍了在 Office 365 中未正确创建全天事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过他们的 REST API 将一些事件导出到 Office 365 中的日历,https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations#EventoperationsCreateevents.

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.

我将 IsAllDay 设置为 true,并将开始和结束时间设置为 UTC 的午夜.

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

有效载荷如下所示:

{
  "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
}

看起来没问题,如果我再次 GET 事件,有效载荷会按原样返回.但是,当我访问 Outlook.office365.com 时,该事件现在跨越 2 天,而不是预期的 1 天.然而,持续时间显示为 1 天.取消单击 Outlook 中的全天"会显示问题.由于我在中欧时间,因此比 UTC 早一小时.开始显示为 2015-01-30 01:00,结束显示为 2015-02-01 00:59.所以在幕后,它似乎并没有在我的时区存储为全天事件.

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.

当您使用 f.ex.EWS,您通常会设置会议的时区,但这似乎是不可能的.

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

我试图用时区信息给出开始和结束,但我得到一个 400,告诉我它必须以 UTC 提供.因此,据我所知,我无能为力,希望微软能解决这个问题.还是我遗漏了什么?

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?

该事件实际上在 Outlook for Mac 中正确显示,所以这可能只是 Outlook.office365.com 上的 OWA 中的一个问题.

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

推荐答案

API 现在支持时区.您在这里要做的不是将您的 StartEnd 指定为 UTC(由末尾的Z"前缀表示),而是在您的时间中指定它区.然后将 StartTimeZoneEndTimeZone 值设置为中欧时间".所以是这样的:

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"
}

这篇关于在 Office 365 中未正确创建全天事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆