问题描述
添加附件 端点似乎有问题.日历收件人看不到附加到日历事件的文件.附件对事件创建者可见.直到最近,我的代码已经运行了几个月,这让我相信这是一种回归.
The add attachment endpoint seems buggy. Files attached to a calendar event are not visible to the calendar recipients. The attachments are visible to the event creator. My code had been working for months until recently, which leads me to believe this is a regression.
- 必须有两个用户 - 创建者和接收者.
- 通过
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events
创建事件 - 通过
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}/attachments
将文件附加到事件 - 以创建者身份转到 Office 365 Web UI.该活动看起来不错,并包含附件.
- 以创建者身份查询 Microsoft 图形 API.活动看起来不错.
hasAttachments
为true
并且通过 API 列出附件按预期工作. - 以收件人身份转到 Office 365 Web UI.活动缺少附件(关于活动的其他一切都是准确的).
- 以收件人身份查询 Microsoft 图形 API.
hasAttachments
是false
并且您无法使用图形 API 列出附件.为了获取收件人的事件 ID,我查询了/calendarView
端点.它返回一个与第 4 步中的事件不同的事件 ID,但对象的其余部分匹配(iCalUId、主题、开始/结束时间等)...除了hasAttachments
.立>
- There must be two users - the creator and the recipient.
- Create an event via
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events
- Attach a file to the event via
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}/attachments
- Go to the Office 365 web UI as the creator. The event looks good and includes the attachment.
- Query the Microsoft graph API as the creator. The event looks good.
hasAttachments
istrue
and listing the attachments via the API works as expected. - Go to the Office 365 web UI as the recipient. The event is missing the attachment (everything else about the event is accurate).
- Query the Microsoft graph API as the recipient.
hasAttachments
isfalse
and you can not list the attachments with the graph API. To get the recipient's event ID, I queried the/calendarView
endpoint. It returns a different event id than the event in step 4, but the rest of the object matches (iCalUId, subject, start/end times, etc)...with the exception ofhasAttachments
.
已尝试修复
我尝试通过 /users/{userId}
端点而不是 /me
端点创建事件并附加文件,结果相同.
Fixes attempted
I tried creating the event and attaching the file via the /users/{userId}
endpoints instead of the /me
endpoints with the same results.
我也尝试了添加附件 beta 端点,但收到以下错误:
I also tried the add attachment beta endpoint but received the following error:
{
"error": {
"code": "NavigationNotSupported",
"message": "Recursive navigation is not allowed after property 'Events' according to the entity schema.",
"innerError": {
"request-id": "{uuid}",
"date": "2018-06-06T06:28:47"
}
}
}
推荐答案
Marc 的解决方法解决了该问题 - 在附件之后添加与会者.工作流程如下所示:
Marc's workaround fixes the issue - add the attendees after the attachments. A working flow looks like:
- 通过 POST 到
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events
创建一个活动(不包括与会者). - 通过 POST 将文件附加到事件
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}/attachments
立> - 通过 PATCH 将第 1 步中的活动与与会者一起更新到
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}
- Create an event (excluding attendees) via POST to
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events
. - Attach a file to the event via POST to
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}/attachments
- Update the event from step 1 with the attendees via PATCH to
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}
一些额外的请求,但它完成了工作.
A few extra requests, but it gets the job done.
这篇关于Office365 REST API - 收件人看不到日历事件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!