如何解决如何使用Google Apps脚本将Google Meet链接添加到新的Google Calendar Event?
我引用的是https://cloud.google.com/blog/products/application-development/hangouts-meet-now-available-in-google和https://developers.google.com/calendar/v3/reference/events,但似乎无法弄清楚如何以编程方式将Google Meet链接添加到Google Calendar事件。这是我的Google Apps脚本代码:
/**
* Creates an event in the user's default calendar.
*/
function createEvent() {
var calendarId = 'primary';
var start = getRelativeDate(1,12);
var end = getRelativeDate(1,13);
var event = {
summary: 'Test Event',description: 'Test.',start: {
dateTime: start.toISOString()
},end: {
dateTime: end.toISOString()
},attendees: [
{email: 'XXXXXX@XXXX.XXX'},],conferenceData: {createRequest: {conferenceSolutionKey: {type: 'hangoutsmeet'}}}
};
event = Calendar.Events.insert(event,calendarId,{sendNotifications: true,conferenceDataVersion: 1} );
Logger.log('Event ID: ' + event.id);
}
/**
* Helper function to get a new Date object relative to the current date.
* @param {number} daysOffset The number of days in the future for the new date.
* @param {number} hour The hour of the day for the new date,in the time zone
* of the script.
* @return {Date} The new date.
*/
function getRelativeDate(daysOffset,hour) {
var date = new Date();
date.setDate(date.getDate() + daysOffset);
date.setHours(hour);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0);
return date;
}
感谢您的帮助。谢谢!
解决方法
我已经成功地使用此代码创建了一个事件,并使用文本变量'summary','id'返回了Meet链接;和日期变量“开始”和“结束”:
var event = {
"summary": summary, "start": {
"dateTime": start.toISOString()
},"end": {
"dateTime": end.toISOString()
}, "conferenceData": {
"createRequest": {
"conferenceSolutionKey": {
"type": "hangoutsMeet"
}, "requestId": id
}
}
};
event = Calendar.Events.insert(event,'primary',{
"conferenceDataVersion": 1});
return event.hangoutLink;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。