Reputation: 26
I wrote the following function in Apps Script to create a Calendar Event (based on information in a Google Sheet), but would like one of the attendees to be the owner so they can see the waiting room for guests. Can I transfer ownership of the event or is there another way to make that happen?
function createEvent(title,start,end,teacher,student) {
// https://developers.google.com/apps-script/advanced/calendar
// https://developers.google.com/calendar/v3/reference/events
var event = {
summary: title,
description: 'Teacher / student meeting',
start: {
dateTime: start.toISOString()
},
end: {
dateTime: end.toISOString()
},
guestsCanInviteOthers: "no",
conferenceData: {
createRequest: {
conferenceSolutionKey: {
type: "hangoutsMeet"
},
requestId: start,
},
},
attendees: [
{email: teacher},
{email: student}
],
};
event = Calendar.Events.insert(event, calendarId, {sendNotifications: false, conferenceDataVersion: 1} );
return event.id;
}
Upvotes: 0
Views: 2245
Reputation: 26796
There are two options to assign the event ownership to a different user
1. Transfer the ownership of an already existing event
creator
or organizer
property, since those parameters are only read-only.2. Use a service account with domain-wide delegation
Upvotes: 2
Reputation: 9571
Set the guestsCanSeeOtherGuests
property to true
.
var event = {
// ...
guestsCanInviteOthers: false, // expected a boolean, not the string "no"
guestsCanSeeOtherGuests: true
};
If using CalendarApp, you can call .setGuestsCanSeeGuests(true)
on the CalendarEvent.
Upvotes: 1