Home > database >  Google Calendar API - Best Method of retrieving latest created event
Google Calendar API - Best Method of retrieving latest created event

Time:11-29

What is the best method of fetching the latest created/modified event created in Calendar itself using Apps Script (either with the CalendarApp or Calendar Advanced service)?

The plan is to have a script to check for any new event matching a specific pattern and log this into a Sheet for appointment booking management. The script would be triggered from the calendar onChange event.

At the moment, the solution I can think of is to pull in all events for a time period and match them against the existing list, but I was wondering if there's a better, more elegant method?

CodePudding user response:

If you check the events.list method you can use Order by which will order the event by the last time it was modified

"updated": Order by last modification time (ascending).

I dont think you can configure watch via app script but its worth considering if you have the ability to put up something that could listen to this it would save you polling. Push notifications

  • Related