Google Calender: Modify Event Guest Status

2019-09-07 15:36发布

In google calendar build in API for my app script.

https://developers.google.com/apps-script/reference/calendar/

What I want to do is get the get the guest of an event and change his status from "yes" to "no".

var calendar = CalendarApp.getCalendarById('id');
var events = calendar.getEventsForDay(today);
Logger.log('Guest Status: ' + events[0].getGuestList()[0].getGuestStatus());

My above code pretty much get the guest and get his status, I am looking at the API page for Event Guest:

https://developers.google.com/apps-script/reference/calendar/event-guest

It only gives you getter methods for the guest, are there any setter methods for event guest? I am looking for a method to set status for guest. How do I do that?

1条回答
趁早两清
2楼-- · 2019-09-07 16:17

Using CalendarApp you are limited to the setMyStatus method and you can only set the event status of the effective user.

If all users are on your domain then you could conceivably run a service account with domain delegation, calling the Calendar API via UrlFetch and impersonating each user, setting their "responseStatus" to "declined" for the event.

查看更多
登录 后发表回答