Search code examples
google-calendar-api

How I can filter meetings which are going to start in given time range


I am working on a specific requirement to filter out any meetings that are going to start in next 15 mins of a given calendar.

I can see that there is timeMax query option which will give events starting before given time but the problem I am facing is that I am also getting older events (which are done in past). Any way to get records only froj now to next 15 mins?

I tried query using syncToken but I guess that doesnt works with timeMax so not able to get just the delta and instead getting all the events.


Solution

  • Calendar Event List API

    As suggested under the comments, you could be using timeMin and timeMax. It should be something similar to:

    timeMin = 2022-12-27T15:30:00+01:00 timeMax = 2022-12-27T15:45:00+01:00

    Notes:

    • Use the query parameters from above and make sure to respect that it must be RFC3339 timestamp.

    This might be the only available option or suggestion when utilizing the event.list to filter them by the 15 minutes mark and check their status. It would be a loop process that could potentially hit a quota.

    var request = Calendar.events.list({
          'calendarId': calendar_id,
          "singleEvents" : true,
          "orderBy" : "startTime",
          "timeMin":  startDate.toISOString(),
          "timeMax":  maxDate.toISOString()
        });
    

    Calendar API limitation

    If these suggestions or options are not enough or can be considered workarounds due to the limitations, you could always request a feature by going under Issue Tracker.

    References