Acl: insert
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
建立存取權控管規則。立即試用。
要求
HTTP 要求
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/acl
參數
參數名稱 |
值 |
說明 |
路徑參數 |
calendarId |
string |
日曆 ID。如要擷取日曆 ID,請呼叫 calendarList.list 方法。如要存取目前登入使用者的主日曆,請使用「primary 」關鍵字。
|
選用查詢參數 |
sendNotifications |
boolean |
是否要傳送日曆共用變更通知。(非必要) 預設值為 True。
|
授權
這項要求需要至少具備下列其中一個範圍的授權:
範圍 |
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.acls |
詳情請參閱「驗證與授權」頁面。
要求主體
在要求主體中,請提供具有下列屬性的 Acl 資源:
屬性名稱 |
值 |
說明 |
附註 |
必要屬性 |
role |
string |
指派給範圍的角色。可能的值包括: - 「
none 」- 不提供存取權。 - 「
freeBusyReader 」:提供空閒/忙碌資訊的讀取權。 - 「
reader 」:提供日曆的讀取權限。私人活動會向具有讀取權限的使用者顯示,但活動詳細資料會隱藏。 - 「
writer 」:提供日曆的讀取及寫入存取權。私人活動會顯示給擁有編輯者存取權的使用者,且可查看活動詳細資料。可讀取日曆的 ACL。 - 「
owner 」:提供日曆的擁有權。這個角色具有 writer 角色的所有權限,並可額外操作 ACL。 |
可寫入 |
scope |
object |
這項 ACL 規則授予的日曆存取權程度。 |
|
scope.type |
string |
範圍的類型。可能的值包括: - 「
default 」- 公開範圍。這是預設值。 - 「
user 」:將範圍限制為單一使用者。 - 「
group 」:將範圍限制為群組。 - 「
domain 」- 將範圍限制為一個網域。 注意:授予「default 」或公開範圍的權限,會套用至任何使用者 (無論是否經過驗證)。 |
|
選用屬性 |
scope.value |
string |
使用者或群組的電子郵件地址,或網域名稱 (視範圍類型而定)。對於類型「default 」,則省略。 |
可寫入 |
回應
如果成功的話,這個方法會在回應內文中傳回 Acl 資源。
試試看!
您可以使用下方的 API Explorer,針對即時資料呼叫這個方法,然後查看回應。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["# Acl: insert\n\n| **Note:** Requires [authorization](#auth).\n\nCreates an access control rule.\n[Try it now](#try-it).\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/calendar/v3/calendars/calendarId/acl\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|---------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `calendarId` | `string` | Calendar identifier. To retrieve calendar IDs call the [calendarList.list](/workspace/calendar/api/v3/reference/calendarList/list) method. If you want to access the primary calendar of the currently logged in user, use the \"`primary`\" keyword. |\n| **Optional query parameters** |||\n| `sendNotifications` | `boolean` | Whether to send notifications about the calendar sharing change. Optional. The default is True. |\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes:\n\n| Scope |\n|-------------------------------------------------|\n| `https://www.googleapis.com/auth/calendar` |\n| `https://www.googleapis.com/auth/calendar.acls` |\n\nFor more information, see the [authentication and authorization](/workspace/guides/configure-oauth-consent) page.\n\n### Request body\n\nIn the request body, supply an [Acl resource](/workspace/calendar/api/v3/reference/acl#resource) with the following properties:\n\n| Property name | Value | Description | Notes |\n|---------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|\n| **Required Properties** ||||\n| `role` | `string` | The role assigned to the scope. Possible values are: - \"`none`\" - Provides no access. - \"`freeBusyReader`\" - Provides read access to free/busy information. - \"`reader`\" - Provides read access to the calendar. Private events will appear to users with reader access, but event details will be hidden. - \"`writer`\" - Provides read and write access to the calendar. Private events will appear to users with writer access, and event details will be visible. Provides read access to the calendar's ACLs. - \"`owner`\" - Provides ownership of the calendar. This role has all of the permissions of the writer role with the additional ability to manipulate ACLs. | writable |\n| `scope` | `object` | The extent to which [calendar access](https://developers.google.com/workspace/calendar/concepts/sharing#sharing_calendars) is granted by this ACL rule. | |\n| scope.`type` | `string` | The type of the scope. Possible values are: - \"`default`\" - The public scope. This is the default value. - \"`user`\" - Limits the scope to a single user. - \"`group`\" - Limits the scope to a group. - \"`domain`\" - Limits the scope to a domain. Note: The permissions granted to the \"`default`\", or public, scope apply to any user, authenticated or not. | |\n| **Optional Properties** ||||\n| scope.`value` | `string` | The email address of a user or group, or the name of a domain, depending on the scope type. Omitted for type \"`default`\". | writable |\n\nResponse\n--------\n\nIf successful, this method returns an [Acl resource](/workspace/calendar/api/v3/reference/acl#resource) in the response body.\n\nTry it!\n-------\n\n\nUse the APIs Explorer below to call this method on live data and see the response."]]