Office365 REST API - Calendar event attachments not visible for recipients

不羁的心 提交于 2020-06-28 10:35:44

问题


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.

Steps to reproduce

  1. There must be two users - the creator and the recipient.
  2. Create an event via https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events
  3. Attach a file to the event via https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}/attachments
  4. Go to the Office 365 web UI as the creator. The event looks good and includes the attachment.
  5. Query the Microsoft graph API as the creator. The event looks good. hasAttachments is true and listing the attachments via the API works as expected.
  6. Go to the Office 365 web UI as the recipient. The event is missing the attachment (everything else about the event is accurate).
  7. Query the Microsoft graph API as the recipient. hasAttachments is false 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 of hasAttachments.

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.

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"
    }
  }
}

回答1:


Marc's workaround fixes the issue - add the attendees after the attachments. A working flow looks like:

  1. Create an event (excluding attendees) via POST to https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events.
  2. Attach a file to the event via POST to https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events/{eventId}/attachments
  3. 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.



来源:https://stackoverflow.com/questions/50714919/office365-rest-api-calendar-event-attachments-not-visible-for-recipients

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!