【发布时间】:2017-09-27 01:55:57
【问题描述】:
我无法使用 Office365 的 Rest API 创建带有附件的日历事件。创建没有附件的事件不是问题。尝试使用附件创建事件会创建事件,但未添加我发送的文件。服务器使用 201 响应代码进行响应。
我正在发送一个 POST 请求到:
https://graph.microsoft.com/v1.0/me/calendars/$(calendarID)/events
我使用以下授权标头:
Authorization: Bearer $(tokenString)
请求负载:
{
"start": {
"dateTime": "2017-09-27T20:00:00.000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2017-09-27T21:00:00.000",
"timeZone": "UTC"
},
"attendees": [
{
"emailAddress": {
"address": "person@example.com"
},
"type": "Required"
}
],
"subject": "Example subject",
"body": {
"content": "Example content",
"contentType": "Text"
},
"hasAttachments": true,
"sensitivity": "Normal",
"attachments": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "$(fileName)",
"contentBytes": "$(base64EncodedString)"
}
]
}
我正在关注https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/calendar_post_events 的文档。我的活动在event schema之后,附件在fileAttachment schema之后。
我为@odata.type 尝试了不同的值,从请求中删除了hasAttachments,以及在附件中添加了名称、大小和内容类型字段。所有这些都给出了相同的结果 - 201 响应,以及一个不带附件创建的事件。
任何帮助将不胜感激,谢谢!
【问题讨论】:
标签: office365 microsoft-graph-api office365api outlook-restapi