Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 应用程序脚本中的日历:每次授权都需要。仅适用于主日历_Google Apps Script_Google Calendar Api_Google Oauth - Fatal编程技术网

Google apps script 应用程序脚本中的日历:每次授权都需要。仅适用于主日历

Google apps script 应用程序脚本中的日历:每次授权都需要。仅适用于主日历,google-apps-script,google-calendar-api,google-oauth,Google Apps Script,Google Calendar Api,Google Oauth,在电子表格中,我有一个用于在谷歌日历中计算小时数的应用程序脚本,并且输出被复制到电子表格中 几天前,一切正常 但是今天(2013年7月1日星期一),当我尝试运行脚本时,每次都会收到消息“Authorized required” 我按下“授权”按钮,然后重新运行,再次得到消息“需要授权” 到 这项工作,但仅对主日历有效。最后,我使用将对日历API的访问更改为CalendarApp服务。getEvents var cal = CalendarApp.getCalendarById(cal_id)

在电子表格中,我有一个用于在谷歌日历中计算小时数的应用程序脚本,并且输出被复制到电子表格中

几天前,一切正常

但是今天(2013年7月1日星期一),当我尝试运行脚本时,每次都会收到消息“Authorized required”

我按下“授权”按钮,然后重新运行,再次得到消息“需要授权”


这项工作,但仅对主日历有效。

最后,我使用
将对日历API的访问更改为CalendarApp服务。getEvents

var cal = CalendarApp.getCalendarById(cal_id);
var this_year = new Date(2013,0,1);
var now = new Date()
var events = cal.getEvents(this_year, now, {search: event_name});
var url = "https://www.googleapis.com/calendar/v3/calendars/"+
calId+"/events?q=" + query + "&key=" + key;
var url = "https://www.googleapis.com/calendar/v3/calendars/"+
"primary"+"/events?q=" + query + "&key=" + key;
var cal = CalendarApp.getCalendarById(cal_id);
var this_year = new Date(2013,0,1);
var now = new Date()
var events = cal.getEvents(this_year, now, {search: event_name});