0

I'm working on a React-big-calendar that use the Google Calendar API to store or retrieve my different events.

My problem is the following: I would like to prevent Events insertion / update / patch if there is already an event on this (or one of the recurrence's instance's) time slot (event if it's just partially).

If the event has recurrence and at least one of the recurrence instances overlap with another event or another event's recurrence instance, I would like to prevent Events insertion / update / patch as well.

The different possibilities left by the Events doc are not enough, I use only one calendar and changing opacity doesn't prevent anything.

The FreeBusy query just help a bit, but not much:

  • First it will ask too much logic for the recurrent event (How do I check that the instances of my recurrent event won't overlap an already existing event, or an instance of another existing recurrent event?).
  • Worst, it also returns the busyness of the current event, so I may have to remove the current event, call the FreeBusy, and then re-create the event so the FreeBusy doesn't take the current event in consideration.

How can I prevent overlapping in this situation with Google Calendar API? Thanks in advance!

Virthuss
  • 3,142
  • 1
  • 21
  • 39
  • You can retrieve the list of events for a particular day/time slot and based on the results, choose to perform the operations or not. Why isn't this a viable option for your use-case? – ale13 Jan 26 '21 at 11:27
  • @ale13 Because imagine I have different recurrence rules that will eventually collide ( but like in months, for example ). Using the list method would require too much logic. As written, it would work for single events, but almost all my events have recurrence and I can't check every single recurrence instances, one by one. – Virthuss Jan 27 '21 at 02:05

1 Answers1

0

Sadly, the only options available in this situation is to query each day or time slot and check the events available.

Since you mentioned that you have recurrent events, you might benefit from making use of the singleEvents parameter when making the Events.list request.

Reference

ale13
  • 5,679
  • 3
  • 10
  • 25