Enum AuthorizationStatus
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
授權狀態
列舉項目,表示指令碼的授權狀態。
如要呼叫列舉,請呼叫其父項類別、名稱和屬性。例如
ScriptApp.AuthorizationStatus.REQUIRED
。
屬性
屬性 | 類型 | 說明 |
REQUIRED | Enum | 使用者必須授權此指令碼使用一或多項服務。在大多數情況下,指令碼會在下次執行時提示使用者授權;不過,如果指令碼是以使用可安裝觸發事件的外掛程式發布,則觸發事件會在執行指令碼時不提示授權,但如果指令碼嘗試呼叫未經授權的服務,則會擲回例外狀況。 |
NOT_REQUIRED | Enum | 使用者已授予這個指令碼目前所需的所有授權。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]