Search code examples
calendarexchangewebservicesicalendar

Import external ICS with EWS


Using Exchange Web Services (EWS), I try to import an ICS from URL. I followed the official documentation : Use the EWS Managed API to import an appointment from an iCal file by using the MIME stream

I'm using EWS Java Api with the following code

var icsApp = new Appointment(ews);
var url = "https://calendar.google.com/calendar/ical/fnb4irrd2df506r50u6fruhqfo%40group.calendar.google.com/public/basic.ics";
byte [] icsContent = IOUtils.toByteArray(new URI(url));
icsApp.setMimeContent(new MimeContent("UTF-8", icsContent));
icsApp.save(edtCalendar.getId(), SendInvitationsMode.SendToNone);

But I don't understand how I can schedule a refresh startegy. Do Exchange server support a this feature ?

Regards, Arnaud


Solution

  • The ics you are referencing contains multiple events, but the EWS method you are using creates only a single event (the first).

    If you want to import all events, you have to parse them (there are libraries for most languages) or split the vevents and create multiple appointments.

    There is no option to refresh the ics file as the Exchange does not support it directly, you would have to implement that yourself.