Here is what I believe to be a bug in the Calendar REST API - but I'm hoping to find a workaround.
In short, I'm able to POST calendar events to a read-only calendar via the API without error. The odd part is that the 365 UI knows that the calendar is read only, and wont allow edits via the UI.
This causes problems with our sync, as when the original calendar publishes again all the new events get deleted. My question is how can I know for certain that the calendar I'm writing to has proper write permissions (as the UI does), and secondly, is it a bug that I can write via API but not through UI?
Steps to reproduce:
- Grab a public, read-only ical calendar address. Eg this
- In 365, right click 'My calendars' and 'open calendar'
- Paste in the address from (1) in the 'internet calendar' field. Calendar should appear under 'My Calendars'. Note that you are unable to create events for this calendar through the UI
- Use
GET https://outlook.office.com/api/v1.0/me/calendars
to get the newly added calendar's ID - Use
POST https://outlook.office.com/api/v1.0/me/calendars/[CALENDAR_ID]/events
to create an event to the new calendar.
Expected behaviour Like the UI, the API does not allow you to write to this calendar.
Actual behaviour Successful creation, 201 created returned. Surprise! After some time (4-6 hours), the newly created event will be deleted. This causes issues if you are syncing this calendar, as the deletion will propagate to whichever client is syncing with that calendar.