0

How to refresh the current calendar event after setting location using event.setLocation(xx)?

I'm developing a calendar addon which provide a search engine for suitable internal locations, user can select the desired one and the addon will set the selected location.

currentEvent.setLocation('My awesome private meeting room');

return CardService.newCalendarEventActionResponseBuilder()
  .addAttendees(['tuan.example@test.nl'])
  .build();

Everything is set correctly, the card is refreshed, but the actual calendar event's location is NOT, only when the whole page is refreshed then it shows the correct location.

It seems only adding attendees or conference data would work.

Thanks,

Tuan D. Nguyen

Tuan Jinn
  • 629
  • 6
  • 7
  • 1
    The object you're using [CalendarEventActionResponseBuilder](https://developers.google.com/apps-script/reference/card-service/calendar-event-action-response-builder.html), only have 2 methods to change event properties (add attendees and set conference data). Any other change you'd have to wait until it gets the new value, not necessarily refreshing the page but just waiting a few seconds. – Andres Duarte Feb 06 '20 at 14:49
  • You might want to try a workaround using [sleep](https://developers.google.com/apps-script/reference/utilities/utilities#sleepmilliseconds) before returning the Card object to delay a few seconds the presentation of the add-on card and thus giving enough time to Calendar UI to update the new values. Let me know if this helps you! – Andres Duarte Feb 06 '20 at 14:52
  • @AndresDuarte nope, that doesn't work. It takes a random oddly long time to update, in fact it doesn't even updated, unless I manually reload the page. CalendarEventActionResponseBuilder, is just an example, I haven't found any useful method to accomplish such a simple requirement :( – Tuan Jinn Feb 07 '20 at 11:25
  • Could you provide an example code so I can try to reproduce your problem? CalendarEventActionResponseBuilder is the only class available for updating events in add-ons, you could file a FR in Google's [issue tracker](https://developers.google.com/issue-tracker#about_issue_tracker) for those methods to be implemented. – Andres Duarte Feb 07 '20 at 11:59

0 Answers0