首页 > 解决方案 > Microsoft Outlook 日历 API 中的 ErrorOccurrenceTimeSpanTooBig?

问题描述

我正在尝试将日历 Outlook API 集成到 laravel 中。

我能够创建简单的事件,但是当我尝试创建重复事件时,我得到了以下响应:

"error": {
    "code": "ErrorOccurrenceTimeSpanTooBig",
    "message": "One occurrence of the recurring calendar  (truncated...)

这是我传递给的有效负载json_encode

array(6) {
  ["subject"]=>
  string(15) "recurring title"
  ["body"]=>
  array(1) {
    ["content"]=>
    string(0) ""
  }
  ["start"]=>
  array(2) {
    ["dateTime"]=>
    string(19) "2019-07-28 12:00:00"
    ["timeZone"]=>
    string(11) "Asia/Taipei"
  }
  ["end"]=>
  array(2) {
    ["dateTime"]=>
    string(19) "2019-08-05 12:00:00"
    ["timeZone"]=>
    string(11) "Asia/Taipei"
  }
  ["location"]=>
  array(1) {
    ["displayName"]=>
    string(18) "location recurring"
  }
  ["recurrence"]=>
  array(2) {
    ["pattern"]=>
    array(3) {
      ["type"]=>
      string(6) "weekly"
      ["interval"]=>
      int(1)
      ["daysOfWeek"]=>
      array(1) {
        [0]=>
        string(6) "Monday"
      }
    }
    ["range"]=>
    array(3) {
      ["type"]=>
      string(7) "endDate"
      ["startDate"]=>
      string(10) "2019-07-28"
      ["endDate"]=>
      string(10) "2019-10-10"
    }
  }
}

然后我在这里传递:

        $createCalendarEventUrl = '/me/calendar/events';
        $graph = new Graph();
        $graph->setAccessToken($this->TokenCacheService->getAccessToken($request));
        $newCalendarEvent = $graph->createRequest('POST', $createCalendarEventUrl)
                        ->attachBody(json_encode($newEvent))
                        ->execute();

我在 Microsoft 的 Docs 中找到了它,但我仍然不清楚如何修复它。

标签: phplaraveloutlookcalendar

解决方案


我很确定您收到错误的原因是因为和之间的差异2019-07-28 12:00:002019-08-05 12:00:008 天,并且您要求 Outlook 每周重复该事件。

您可以尝试将其设置为<= 7 days吗?


推荐阅读