For example, let's say a conference room was booked for a 12-1pm meeting. At 9am that same morning, a user cancelled that meeting, freeing up the conference room. Is there any way to programmatically run a script which would indicate, if run at 10am, that the room had become available one hour ago?
Asked
Active
Viewed 42 times
1 Answers
1
If you retrieve the event that was cancelled via Events.get, you can get the updated
time field as a response, which, in case the event got cancelled, equals the time the event was cancelled. Then, the script can calculate the difference between current time and the time it got cancelled.
You could also use Freebusy to make sure that no one created another event after the previous one got cancelled and that the resource is free for that time.
Update
If you want to know for how long a certain conference room has been free for a certain time, you can:
- Get the list of events related to this resource via Events.list, including the ones that were cancelled (set
showDeleted
totrue
) to achieve that. - Check if there are any events whose scheduled time matches the time you want to look for (fields
start
andend
). - If any of these events matches, you can calculate, for that event (and in case the event got cancelled and the resource is indeed free - event status is
cancelled
), the difference between current time and the time the event got cancelled (by checking the fieldupdated
).
I hope this is what you wanted.

Community
- 1
- 1

Iamblichus
- 18,540
- 2
- 11
- 27
-
Great idea -- just not sure if it would work at a scale where there are hundreds of conference rooms and thousands of users. In other words, how would one be able to determine, for a given conference room, which event was canceled that had previously booked it? – Ryan Dec 10 '19 at 14:32
-
@Ryan I updated my response based on your comment. Let me know if that works for you. – Iamblichus Dec 10 '19 at 15:24