I am building a GSuite Calendar extension.
My extension adds custom information to the description of the new event and needs to systematically add the guest email e.g. [email protected].
The extension has content-script which injects HTML and javascript in Google calendar add event page. This HTML creates a button on the add event page and when user clicks this button then javascript adds custom information to the description.
Here is the HTML to add button in add event page.
html() {
return `<div>
<strong>
<a href='#add-description' id="add-description-btn" data-toggle="modal" data-backdrop='static' data-keyboard='false'>Add Custom Details</a>
</strong>
</div>`;
}
Here is the function which injects HTML and javascript in add event page.
inject(eventType) {
const eventDetails = $('#tabEventDetails');
eventDetails.find('div:first').after(html(eventType));
// More javascript
}
Here is the function which adds custom details to description.
addDescription(content) {
$('[aria-label="Description"]').html(content);
}
I am able to inject into the description, but how can I add a guest programmatically without any user intervention?
Is there any way I can add that guest email using javascript? or use a post save tigger if any?
Any pointers?
Add to array 'attendees' objects like {'email': '[email protected]'}:
var event = {
'summary': 'Google I/O 2015',
'location': '800 Howard St., San Francisco, CA 94103',
'description': 'A chance to hear more about Google\'s developer products.',
'start': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': '[email protected]'},
{'email': '[email protected]'}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': event
});
request.execute(function(event) {
appendPre('Event created: ' + event.htmlLink);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With