我正在尝试获取特定Google日历活动的受邀嘉宾的状态。
// receives and EventGuest object
// https://developers.google.com/apps-script/reference/calendar/event-guest
function getInviteeStatus(eventguest) {
var gueststatus,
guestname = eventguest.getName(),
guestemail = eventguest.getEmail(),
guestguestcount = eventguest.getAdditionalGuests(),
gueststatusObj = eventguest.getGuestStatus(); // returns a GuestStatus object
// export enum GuestStatus { INVITED, MAYBE, NO, OWNER, YES } - this is from some docs I found
// how do I convert the GuestStatus object to a string that represents the status?
//gueststatus = ???
return [guestname, guestemail, guestguestcount, gueststatus]
}
答案 0 :(得分:1)
您想要将INVITED, MAYBE, NO, OWNER, YES
检索为字符串。如果我的理解是正确的,那么这个修改怎么样?
gueststatusObj = eventguest.getGuestStatus();
Logger.log("%s, %s", gueststatusObj, typeof gueststatusObj) // INVITED, object
gueststatusObj = eventguest.getGuestStatus().toString();
Logger.log("%s, %s", gueststatusObj, typeof gueststatusObj) // INVITED, string
INVITED
用作示例。如果我误解了你的问题,我很抱歉。