0

使用重复字段创建日历事件失败。以下是来自 Chrome 网络选项卡的示例请求负载:

成功(没有重复字段):

Attendees: []
Body: {ContentType: "HTML", Content: ""}
End: "2015-05-14T16:29:40.307Z"
Start: "2015-05-14T16:29:40.307Z"
Subject: "Regular event"

失败的请求(带有重复字段): 请求屏幕截图

Attendees: []
Body: {
  ContentType: "HTML",
    Content: ""
}
End: "2015-05-14T16:29:40.307Z"
Recurrence: {
  Pattern: {
    DayOfMonth: 0
    FirstDayOfWeek: "Sunday"
    Interval: 1
    Month: 0
    Type: "Daily"
  }
  Range: {
    EndDate: "2015-05-23T00:00:00+03:00"
    NumberOfOccurences: 0
    StartDate: "2015-05-17T00:00:00+03:00"
    Type: "EndDate"
  }
}
Start: "2015-05-14T16:29:40.307Z"
Subject: "Regular event"

在上述情况下,服务器返回的错误如下:

"error": {
    "code": "ErrorInvalidRequest",
    "message": "Cannot read the request body."
}

任何人都可以检查上述请求并告诉我重复规则中缺少什么并阻止保存日历事件吗?还是 API 当前不支持创建重复事件?

用于请求的 URL: https ://outlook.office365.com/api/v1.0/me/events

请求方法:POST

4

1 回答 1

1

您的条目似乎Recurrence缺少包装“{}”,并且子字段之间没有逗号。由于服务器上的 OData 读取器无法解析它,因此会抛出“无法读取请求正文”错误。

尝试:

{
  Attendees: [],
  Body: {
    ContentType: "HTML",
    Content: ""
  },
  End: "2015-05-14T16:29:40.307Z",
  Recurrence: {
    Pattern: {
      DayOfMonth: 0,
      FirstDayOfWeek: "Sunday",
      Interval: 1,
      Month: 0,
      Type: "Daily"
    },
    Range: {
      EndDate: "2015-05-23T00:00:00+03:00",
      NumberOfOccurrences: 0,
      StartDate: "2015-05-17T00:00:00+03:00",
      Type: "EndDate"
    }
  },
  Start: "2015-05-14T16:29:40.307Z",
  Subject: "Regular event"
}
于 2015-05-14T17:09:12.540 回答