Method: permissions.patch
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
อัปเดตสิทธิ์โดยใช้ความหมายของแพตช์
คำเตือน: ระบบไม่รองรับการดำเนินการเกี่ยวกับสิทธิ์พร้อมกันในไฟล์เดียวกัน ระบบจะใช้เฉพาะการอัปเดตครั้งล่าสุดเท่านั้น
คำขอ HTTP
PATCH https://www.googleapis.com/drive/v2/files/{fileId}/permissions/{permissionId}
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
fileId |
string
รหัสของไฟล์หรือไดรฟ์ที่แชร์
|
permissionId |
string
รหัสของสิทธิ์
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
removeExpiration |
boolean
ต้องการนําวันที่หมดอายุออกหรือไม่
|
supportsAllDrives |
boolean
แอปพลิเคชันที่ขอรองรับทั้งไดรฟ์ของฉันและไดรฟ์ที่แชร์หรือไม่
|
supportsTeamDrives (deprecated) |
boolean
เลิกใช้งานแล้ว: ให้ใช้ supportsAllDrives แทน
|
transferOwnership |
boolean
การเปลี่ยนบทบาทเป็น owner จะลดระดับเจ้าของปัจจุบันให้เป็นผู้เขียนหรือไม่ จะไม่ดำเนินการใดๆ หากบทบาทที่ระบุไม่ใช่ owner
|
useDomainAdminAccess |
boolean
ส่งคำขอในฐานะผู้ดูแลระบบโดเมน หากตั้งค่าเป็น "จริง" ผู้ขอจะได้รับสิทธิ์เข้าถึงหากพารามิเตอร์รหัสไฟล์อ้างอิงถึงไดรฟ์ที่แชร์และผู้ขอเป็นผู้ดูแลระบบของโดเมนที่เป็นเจ้าของไดรฟ์ที่แชร์
|
enforceExpansiveAccess |
boolean
กำหนดว่าคำขอควรบังคับใช้กฎการเข้าถึงแบบขยายหรือไม่
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ Permission
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ Permission
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
ขอบเขตบางอย่างถูกจํากัดและต้องมีการประเมินความปลอดภัยเพื่อให้แอปของคุณใช้งานได้ ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Method: permissions.patch\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\nUpdates a permission using patch semantics.\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`PATCH https://www.googleapis.com/drive/v2/files/{fileId}/permissions/{permissionId}`\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 for the file or shared drive. |\n| `permissionId` | `string` The ID for the permission. |\n\n### Query parameters\n\n| Parameters ||\n|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `removeExpiration` | `boolean` Whether to remove the expiration date. |\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 changing a role to `owner` downgrades the current owners to writers. Does nothing if the specified role is not `owner`. |\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/v2/permissions#Permission).\n\n### Response body\n\nIf successful, the response body contains an instance of [Permission](/workspace/drive/api/reference/rest/v2/permissions#Permission).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/docs`\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)."]]