1

I am adding an event using Google Calendar Java API (version v3-rev305-1.23.0). Event addition goes successfully but the problem I am facing is the reminders that appear in the event.

My code structure is same as available in Java example on this - https://developers.google.com/calendar/create-events#java. And I have provided the code snippet of the event reminder below.

    Event event = new Event()
        .setSummary(insertEvent.getSummary())
        .setDescription(insertEvent.getDesc());

    DateTime reminderDate = DateTime.parseRfc3339(insertEvent.getReminderDate());
    EventDateTime start = new EventDateTime().setDate(reminderDate);
    event.setStart(start);
    EventDateTime end = new EventDateTime().setDate(reminderDate);
    event.setEnd(end);

    List<EventAttendee> attendees = new ArrayList<>();
    for (String reminderEmail : insertEvent.getReminderEmails()) {
      attendees.add(new EventAttendee().setEmail(reminderEmail));
    }
    event.setAttendees(attendees);

    EventReminder[] reminderOverrides = new EventReminder[] {
        new EventReminder().setMethod("email").setMinutes(5 * 24 * 60),
        new EventReminder().setMethod("popup").setMinutes(10),
    };
    Event.Reminders reminders = new Event.Reminders()
        .setUseDefault(false)
        .setOverrides(Arrays.asList(reminderOverrides));
    event.setReminders(reminders);

    event = this.calendar.events().insert(insertEvent.getCalendarId(), event).execute();

Please note that there are 2 reminders being set here, one being an email 5 days before and second is a popup 10 minutes before. But after the event is created I see different reminders. They are also 2 reminders but not the ones that I have coded and executed. If anyone is facing such an issue then please let me know how to solve this. Thanks very much.

enter image description here

Ketan
  • 738
  • 2
  • 9
  • 20
  • I cannot reproduce this behaviour, I'm getting the notifications that I set. Are you sure this is the code you used? Can you provide the code related to the API call itself? – Iamblichus Jun 01 '20 at 10:48
  • Thanks @Iamblichus for your time and comment. I have added the full code. – Ketan Jun 02 '20 at 02:16

1 Answers1

1

Are you checking the reminders view in the Calendar UI with the same user that created the event via the API? Reminders are set per-attendee and cannot be modified / set by any other user including the event organizer / creator.

For details read about shared / private properties of events in the Calendar API.

Jay Lee
  • 13,415
  • 3
  • 28
  • 59
  • Thanks @Jay Lee. This makes sense. I have gone through the link you have provided and also through https://developers.google.com/calendar/v3/reference/events. Especially I checked the "attendees": block and "reminders": block. However I fail to find if there is anyway to enforce the same set of reminders for all other attendees too! Please let me know if it is even possible. – Ketan Jun 02 '20 at 04:19
  • @Ketan I don't think you can set reminders for the other attendees. The following quote from [private event properties](https://developers.google.com/calendar/concepts/sharing#private_event_properties) is quite clear on that: "**These properties are controlled by the attendee's settings and not by the organizer calendar**". But you could change those settings yourself if you had access to their event copies (with a Service Account, or what have you). – Iamblichus Jun 02 '20 at 13:06
  • 1
    Correct, organizer can't set attendees reminders. This makes sense if you think about it, why would I want you to tell me when to be reminded of a meeting I have? If you need to edit an attendee's reminders, you need to be able to authorize as the attendee. – Jay Lee Jun 02 '20 at 13:17