Enum AuthorizationStatus
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
授权状态
用于表示脚本授权状态的枚举。
如需调用枚举,您可以调用其父类、名称和属性。例如
ScriptApp.AuthorizationStatus.REQUIRED
。
属性
属性 | 类型 | 说明 |
REQUIRED | Enum | 用户需要授权此脚本使用一项或多项服务。在大多数情况下,脚本会在下次运行时提示用户授权;但是,如果脚本作为使用可安装触发器的插件发布,则触发器会在运行脚本时不提示用户授权,但如果脚本尝试调用未经授权的服务,则会抛出异常。 |
NOT_REQUIRED | Enum | 用户已向此脚本授予其当前所需的所有授权。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eAuthorizationStatus is an enumeration used to represent the authorization level of a script.\u003c/p\u003e\n"],["\u003cp\u003eScripts may require user authorization to access certain services, indicated by \u003ccode\u003eScriptApp.AuthorizationStatus.REQUIRED\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIf a script has all necessary authorizations, its status is represented by \u003ccode\u003eScriptApp.AuthorizationStatus.NOT_REQUIRED\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAdd-ons using installable triggers might run without explicit authorization prompts but will throw exceptions when attempting to use unauthorized services.\u003c/p\u003e\n"]]],[],null,["# Enum AuthorizationStatus\n\nAuthorizationStatus\n\nAn enumeration denoting the authorization status of a script.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nScriptApp.AuthorizationStatus.REQUIRED`. \n\n### Properties\n\n| Property | Type | Description |\n|----------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `REQUIRED` | `Enum` | The user needs to authorize this script to use one or more services. In most cases, the script prompts the user for authorization the next time it runs; however, if the script is published as an [add-on](/gsuite/add-ons/overview) that uses [installable triggers](/apps-script/understanding_triggers), the trigger runs the script without prompting for authorization but throws an exception if the script attempts to call the unauthorized service. |\n| `NOT_REQUIRED` | `Enum` | The user has granted this script all the authorization it currently requires. |"]]