TypeError:在对象Calendar中找不到函数createAllDayEvent

时间:2017-10-17 14:55:53

标签: google-apps-script runtime-error google-calendar-api

这是我的代码片段。我几个月没有修改它,它一直在顺利工作,直到今天我突然得到一个" TypeError:在对象Calendar中找不到函数createAllDayEvent。"当我尝试提交我的Google表单时。

有人能够指出我可能是什么原因吗?它是谷歌更新还是他需要更新的东西,因为谷歌改变了什么?感谢

//Get the calendar
  try{
    var cal = CalendarApp.getCalendarById('davie.k12.nc.us_d2mv2eb8aspuant1vb5j6r3sis@group.calendar.google.com');//Change the calendar id, this one is shared with you and is a test agenda where we can write ANYTHING ;-)
    if(cal){
      //Create the events
      Logger.log(eventDate);
      var newID = cal.createAllDayEvent(eventCalSubject, eventDate, {description:eventCalDetails}).getId();
    }

1 个答案:

答案 0 :(得分:3)

我的脚本也在过去24小时内破了。我提交了一个问题: https://issuetracker.google.com/67890149

参考示例产生相同的错误:

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'),
    {location: 'Bethel, White Lake, New York, U.S.', sendInvites: true});
Logger.log('Event ID: ' + event.getId());