0
votes

I am using google calendar API with the JAVA client library to create event and send invitation to attendees.

I have some requirement where I want to add new attendees after the event has been created. I am able to add attendees successfully but since I am sending notification on adding attendees (actually on all updates), the code sends email to all attendees even if I add one attendee to the list.

Can anyone please help to change the setting so that if I make some updates to the content like Title, time, description, location etc. Then the mail should be send to all the attendees; but if I add an attendee then only that attendee must receive an email that he/she has been invited.

Code for adding attendees:

    Event event = service.events().get("primary", eventId).execute();

    List<EventAttendee> attendees = event.getAttendees();
    attendees.add(new EventAttendee().setEmail("[email protected]"));
    event.setAttendees(attendees);
    Event updatedEvent = service.events().update("primary", event.getId(), event).setSendNotifications(Boolean.TRUE).execute();
1
try using Patch instead of update update will update all of the fields there by sending an email to everyone already there. while patch will just update what you want changing which is just adding a new user developers.google.com/google-apps/calendar/v3/reference/events/…DaImTo
Thankyou @DaImTo for your comment. It helped me. By the way update also worked now.Harsh Jain
If you fixed it you should answer your own question.DaImTo

1 Answers

0
votes

Patch worked for sending updates only to the new attendees. But later I figured out that update also worked and didn't sent mail to all the attendees.