使用重复字段创建日历事件失败。以下是Chrome网络标签中的示例请求负载:
成功(没有重复字段):
$("#result ul").append('<li><a href="#">'+out.title+'</a></li>');
失败请求(带重复字段): Request screenshot
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"
任何人都可以检查上述请求并告诉我重复规则中缺少什么并阻止保存日历事件吗?或者API目前不支持创建定期事件?
用于请求的网址: https://outlook.office365.com/api/v1.0/me/events
请求方法:POST
答案 0 :(得分: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"
}