Method: permissions.create
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ファイルまたは共有ドライブの権限を作成します。
警告: 同じファイルに対する権限操作の同時実行はサポートされていません。最後の更新のみが適用されます。
HTTP リクエスト
POST https://www.googleapis.com/drive/v3/files/{fileId}/permissions
この URL は gRPC Transcoding 構文を使用します。
パスパラメータ
パラメータ |
fileId |
string
ファイルまたは共有ドライブの ID。
|
クエリ パラメータ
パラメータ |
emailMessage |
string
通知メールに含める書式なしテキストのカスタム メッセージ。
|
enforceSingleParent (deprecated) |
boolean
非推奨: 詳しくは、moveToNewOwnersRoot をご覧ください。
|
moveToNewOwnersRoot |
boolean
このパラメータは、アイテムが共有ドライブにない場合にのみ有効になり、リクエストでアイテムの所有権の譲渡を試みます。true に設定すると、アイテムは新しいオーナーのマイドライブのルートフォルダに移動し、以前の親フォルダはすべて削除されます。false に設定されている場合、親は変更されません。
|
sendNotificationEmail |
boolean
ユーザーまたはグループに共有するときに通知メールを送信するかどうか。ユーザーとグループのデフォルトは true で、他のリクエストは許可されません。所有権の譲渡では無効にできません。
|
supportsAllDrives |
boolean
リクエスト元のアプリケーションがマイドライブと共有ドライブの両方をサポートしているかどうか。
|
supportsTeamDrives (deprecated) |
boolean
非推奨: 代わりに、supportsAllDrives を使用してください。
|
transferOwnership |
boolean
指定したユーザーに所有権を譲渡し、現在の所有者を書き込み権限にダウングレードするかどうか。このパラメータは、副作用を確認するために必要です。
|
useDomainAdminAccess |
boolean
リクエストをドメイン管理者として発行します。true に設定すると、ファイル ID パラメータが共有ドライブを参照し、リクエスト元が共有ドライブが属するドメインの管理者である場合、リクエスト元にアクセス権が付与されます。
|
enforceExpansiveAccess |
boolean
リクエストで広範なアクセスルールを適用するかどうか。
|
リクエストの本文
リクエストの本文には Permission
のインスタンスが含まれます。
レスポンスの本文
成功した場合、レスポンスの本文には、新しく作成された Permission
のインスタンスが含まれます。
認可スコープ
次の OAuth スコープのいずれかが必要です。
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
一部のスコープは制限されており、アプリでそれらを使用するにはセキュリティ評価が必要です。詳しくは、承認ガイドをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-27 UTC。
[null,null,["最終更新日 2025-08-27 UTC。"],[],[],null,["# Method: permissions.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a permission for a file or shared drive.\n\n**Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v3/files/{fileId}/permissions`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|----------------------------------------------|\n| `fileId` | `string` The ID of the file or shared drive. |\n\n### Query parameters\n\n| Parameters ||\n|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `emailMessage` | `string` A plain text custom message to include in the notification email. |\n| `enforceSingleParent` **(deprecated)** | `boolean` Deprecated: See `moveToNewOwnersRoot` for details. |\n| `moveToNewOwnersRoot` | `boolean` This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed. |\n| `sendNotificationEmail` | `boolean` Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers. |\n| `supportsAllDrives` | `boolean` Whether the requesting application supports both My Drives and shared drives. |\n| `supportsTeamDrives` **(deprecated)** | `boolean` Deprecated: Use `supportsAllDrives` instead. |\n| `transferOwnership` | `boolean` Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. |\n| `useDomainAdminAccess` | `boolean` Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs. |\n| `enforceExpansiveAccess` | `boolean` Whether the request should enforce expansive access rules. |\n\n### Request body\n\nThe request body contains an instance of [Permission](/workspace/drive/api/reference/rest/v3/permissions#Permission).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Permission](/workspace/drive/api/reference/rest/v3/permissions#Permission).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.file`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]