Search code examples
office365apimicrosoft-graph-api

Handling external (internet/.ics) calendar URLs using Microsoft Graph API


In the new Graph API, is it possible to create a new calendar for a user based on an external .ics calendar URL?

What I'd like to do is to use a daemon to inject a link to an external calendar into the list of calendars a user has if they don't already have such a link. This would be effectively replicating what the user could manually do in OWA by right clicking on "Other calendars", selecting "open calendar" and then pasting in the URL for the .ics calendar file. I want to do this to try to work around the lack of Unified Group calendar support in Graph API as I effectively want these to be read only calendars for the users (and also to save having to make many thousands of API calls to inject individual events in each user's calendar when we've got thousands of users each having to have hundreds of events maintained).

I can use the Graph API call:

GET https://graph.microsoft.com/v1.0/users/<user_id>/calendars

to list all the calendars in the user's default group, which includes the external calendar if it has been manually added in OWA. Then I can make a second API to get the events in the calendar:

GET https://graph.microsoft.com/v1.0/users/<user_id&gr;/calendars/<calendar_id>/events

to get the events from the external calendar with ID calendar_id. That all works.

However I don't see a where in the Calendar resource I can specify the URL for the external calendar when calling the Create Calendar method in the Graph API. Also as the external URL doesn't appear in the Calendar resource I can't easily check to see if the correct external calendar is included from the calendar listing above. All I have to go on is the "name", and of course the user is free to change that (and as I'm looking at student calendars for timetabling, they'll almost certainly try to rename/remove/break them in interesting ways).

Am I missing some option to the Create Calendar method in the API, or is this another part of the Graph API calendar handling that isn't yet design/implemented?


Solution

  • Creating a calendar using an external calendar ICS feed is a great scenario but not yet supported. Since we have received multiple requests for the ability to do this through our REST APIs, we are looking into it, but I don't have a timeline right now. For now, only option is to add the calendar using OWA, and yes, I understand this doesn't help with your scenario.