0
votes

In my app I can add attendee into calendar event like that:

Calendar.Events.Get calendarEventGet = calendar.events().get(calendarId, event.getId());
Event eventToUpdate = calendarEventGet.execute();
List<EventAttendee> attendees = CollectionUtils.isEmpty(eventToUpdate.getAttendees()) ?
                                        new ArrayList<>() : eventToUpdate.getAttendees();
attendees.add(testAttendee);
eventToUpdate.setAttendees(attendees);
calendar.events()
        .update(calendarId, eventToUpdate.getId(), eventToUpdate)
        .execute();

Now I have recurrent event eg. for every Monday and I want to add new attendee just for upcomming Monday (eg for 30.8.2021 ONLY). So in the eventToUpdate I will get event having: RRULE:FREQ=WEEKLY;BYDAY=MO;INTERVAL=1. And I need to get somehow representation of 30.8.2021 event.

Thanks for any suggestions!

1

1 Answers

1
votes

Use Events:instances to retrieve the desired instance and modify it

Follow the guide for Modifying or deleting instances.

In your case it should be something like:

Events instances = service.events().instances(calendarId, event.getId()).execute();

// Select the instance to modify - if in your case it is not the first one - modify the "0" accordingly

Event instance = instances.getItems().get(0);
instance.setAttendees(attendees);

Event updatedInstance = service.events().update(calendarId, instance.getId(), instance).execute();