Reputation: 1201
I was trying to get the number of events that a specific user created in the past month using Google Calendar API.
The problem is that I got all the events where a user was invited. I don't see how to query only the events that user created.
calendarId: user's email adress updatedMin : today - one month
I am using Google's api explorer to query Calendar API.
Upvotes: 4
Views: 1405
Reputation: 721
Include a query parameter in your request:
This will filter to only events organized by [email protected].
Updated:
Unfortunately the query parameter does not accept key value pairs. This solution will not work.
Upvotes: 1
Reputation: 11194
You can filter them by creator.email
or organizer.email
function getCreatedEvents() {
var user = '[email protected]';
var today = new Date();
var date = new Date();
date.setMonth(date.getMonth() - 1);
var args = {
timeMin: new Date(date.getTime()).toISOString(),
timeMax: new Date(today.getTime()).toISOString()
}
var events = Calendar.Events.list(user, args).items;
events.forEach(function (event){
if(event.creator && event.creator.email == user){
// do something to events
Logger.log(event);
}
});
}
Upvotes: 1