คุณแชร์ไฟล์และโฟลเดอร์ใน Google ไดรฟ์กับผู้อื่นได้โดยใช้
UI ของไดรฟ์หรือผ่าน
Google Drive API เมื่อแชร์จากไดรฟ์ คุณสามารถกำหนดได้ว่าจะให้บุคคลอื่นแก้ไข แสดงความคิดเห็น หรือแค่เปิดไฟล์ได้อย่างเดียว
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Access link-shared Drive files using resource keys\n\nYou can share Google Drive files and folders with others using the [Drive UI](/workspace/drive/api/guides/about-apps) or through the [Google Drive API](/workspace/drive/api/guides/create-file). When you share from\nDrive, you can control whether people can edit, comment on, or\nonly open the file.\n\nA *resource key* helps protect your file from unintended access. Resource keys\nare an additional parameter that are passed so users can access certain files\nthat have been shared using a link. Users who haven't viewed the file before\nmust provide the resource key to gain access. Those who have recently viewed the\nfile, or have direct access, don't need the resource key to access the file.\n\nA Drive file that's shared with a link can only be discovered by\nusers that can access the file as a result of a `type=user` or `type=group`\n[`permissions`](/workspace/drive/api/reference/rest/v3/permissions) resource. Requests from users\nthat only have access to these link-shared files using a `type=domain` or\n`type=anyone` permission might require a resource key.\n\nFor more information about permissions, see [Share files, folders and drives](/workspace/drive/api/guides/manage-sharing). For a complete list of roles and the operations\npermitted by each, see [Roles \\& permissions](/workspace/drive/api/guides/ref-roles).\n\nRead the resource key from the file\n-----------------------------------\n\nThe Drive API returns a file's resource key on the read-only\n`resourceKey` field of the [`files`](/workspace/drive/api/reference/rest/v3/files) resource.\n\nIf the file is a [Drive shortcut](/workspace/drive/api/guides/shortcuts), the\nresource key for the shortcut target is returned on the read-only\n`shortcutDetails.targetResourceKey` field.\n\nFields in the [`files`](/workspace/drive/api/reference/rest/v3/files) resource that return URLs,\nsuch as `exportLinks`, `webContentLink`, and `webViewLink`, also include the\n`resourceKey`. Clients that integrate with the Drive UI can also\nuse `resourceKeys` within the [`state`](/workspace/drive/api/guides/enable-sdk#construct)\nparameter. For more information, see [Download and export\nfiles](/workspace/drive/api/guides/manage-downloads).\n\nSet the resource key on the request\n-----------------------------------\n\nResource keys for any files referenced by requests to the Drive API\nare set on the `X-Goog-Drive-Resource-Keys` HTTP header.\n\nRequests to the Drive API can specify one or more resource keys with\nthe `X-Goog-Drive-Resource-Keys` HTTP header.\n\n### Syntax\n\nA file ID and resource key pair are set on the header using a forward slash\n(`/`) separator. The header is built by combining all the file ID and resource\nkey pairs using comma (`,`) separators.\n\nFor example, consider a request to move file `fileId1` from folder `fileId2` to\nfolder `fileId3`. Assume the resource keys for these three files are\n`resourceKey1`, `resourceKey2`, and `resourceKey3`, respectively. The header\nbuilt from these values using a forward slash and comma separators is: \n\n X-Goog-Drive-Resource-Keys: fileId1/resourceKey1,fileId2/resourceKey2,fileId3/resourceKey3\n\n### Related topics\n\n- [Share files, folders and drives](/workspace/drive/api/guides/manage-sharing)\n- [Download and export files](/workspace/drive/api/guides/manage-downloads)\n- [Protect file content](/workspace/drive/api/guides/content-restrictions)\n- [Configure a Drive UI integration](/workspace/drive/api/guides/enable-sdk)"]]