Is there a way to retrieve deleted calendar events in Google Apps Script? I'm trying to keep track of our rate of meeting cancellations. I can see deleted events in the calendar's Trash (folder?), but am unable to retrieve them using the CalendarApp's getEvents API.
I've tried querying using:
myCalndar.getEvents(some_days_past, now, {search: "in:Trash"});
as well as numerous variations of search strings and optional properties, but none return any results.
Any ideas?
For the record, I've been going by the API documented here:
https://developers.google.com/apps-script/reference/calendar/calendar-app
You can use "Calendar API v3". "Calendar API v3" can be used at Google Apps Script by enabling Calendar API of Advanced Google services and of Google API Console.
How to use it is as follows.
In the script editor, select Resources > Advanced Google services
In the dialog that appears, click the on/off switch for Calendar API v3
At the bottom of the dialog, click the link for the Google API Console.
In the console, click into the filter box and type part of the name of the API "Calendar", then click the name once you see it.
On the next screen, click Enable API.
Close the Developers Console and return to the script editor. Click OK in the dialog. The advanced service you enabled is now available in autocomplete.
The detail information is https://developers.google.com/apps-script/guides/services/advanced.
A script for retrieving a list of trashed events is as follows. Response if JSON.
Script :
var response = Calendar.Events.list(
"CalendarId", {
showDeleted: true,
fields: "items(id,summary)"
}
);
Response :
{
"items": [
{
"id": "####",
"summary": "test1"
},
{
"id": "####",
"summary": "test2"
}
]
}
At this sample, id and summary are set as fields. If you want other fields, please check https://developers.google.com/google-apps/calendar/v3/reference/events.
If I misunderstand your question, I'm sorry.