Calendar 在对象中找不到函数createEvent

Calendar 在对象中找不到函数createEvent,calendar,Calendar,我不知道为什么我会犯这个错误。。。此脚本中的所有其他代码都已注释掉。。。 任何帮助都将不胜感激 错误消息:TypeError:在对象中找不到函数createEvent。(第16行,文件“代码”) (朋友想出来了) 这两个人打得不好 createEvent和getCalendarsByName createEvent必须使用getCalendarsByID添加标志来指定您使用的语言/技术 function createEvent(test) { var cal = CalendarApp.get

我不知道为什么我会犯这个错误。。。此脚本中的所有其他代码都已注释掉。。。 任何帮助都将不胜感激

错误消息:TypeError:在对象中找不到函数createEvent。(第16行,文件“代码”)

(朋友想出来了) 这两个人打得不好

createEvent和getCalendarsByName


createEvent必须使用getCalendarsByID

添加标志来指定您使用的语言/技术
function createEvent(test) 
{
var cal = CalendarApp.getCalendarsByName(test);
var title = 'Script Demo Event';
var start = new Date("April 5, 2013 08:00:00 PDT");
var end = new Date("April 5, 2013 10:00:00 PDT");
var desc = "Created using Google Apps Script";
var loc = "Script Center";
var event = cal.createEvent(title, start, end, {description:desc, location:loc});
};