问题描述
我已经执行了几年的gscript,但是直到今天,当我尝试执行gscript时,我才开始看到以下内容:
I've been executing a gscript for a couple years now, but just today I started seeing the following when I try to execute it:
我继续进行操作,并从帐户权限"页面取消了对脚本的授权,然后重新运行了脚本以强制进行重新认证,但是我仍然看到错误.
I went ahead and deauthorized my script from my Account permissions page and re-ran the script to force re-auth, but I'm still seeing the error.
有问题的行只是试图做:
The line in question is simply trying to do:
CalendarApp.getDefaultCalendar()
关于如何解决此问题的任何想法?
Any idea on how to resolve this issue?
推荐答案
从遇到的错误中可以看出,该脚本缺少运行所需的授权.在脚本编辑器中或从自定义菜单项中运行脚本时,将向用户显示一个授权对话框.但是,当从触发器运行脚本,将脚本嵌入Google网站页面或作为服务运行脚本时,将无法显示对话框,并且会显示此错误.
From what error you've encountered, it indicates that the script lacking the authorization needed to run. When a script is run in the Script Editor or from a custom menu item an authorization dialog is presented to the user. However, when a script is run from a trigger, embedded with a Google Sites page, or run as a service, the dialog cannot be presented and this error is shown.
如果脚本包含新的未授权服务,则必须重新授权该脚本.这是有关如何对此类问题进行故障排除的文档Google Apps脚本中出现错误.
If the script contains new unauthorized services, you must re-authorize the script. Here's a documentation on how to troubleshoot this type of error in Google Apps Script.
如果触发器继续触发并导致此错误,则可以执行以下操作来访问触发器:
If a trigger continues to fire and cause this error, you can access your triggers by doing the following:
- 在Apps脚本编辑器中选择编辑>所有触发器.出现的对话框显示了您帐户上正在运行的所有活动触发器.
- 在列表中找到有问题的触发器.
- 单击触发器名称旁边的清除图标将其删除.
- 点击保存以记录删除.
- Select Edit > All your triggers in the Apps Script editor. The resulting dialog shows all active triggers running on your account.
- Find the offending trigger in the list.
- Click the clear icon next to the trigger name to remove it.
- Click Save to record the deletion.
您还可以通过卸载插件.
这篇关于授权授予CalendarApp后,脚本无权执行该操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!