ความแตกต่างของไดรฟ์ที่แชร์กับ API ไดรฟ์ของฉัน
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ไดรฟ์ที่แชร์มีรูปแบบการจัดระเบียบ การแชร์ และการเป็นเจ้าของที่แตกต่างจาก
ไดรฟ์ของฉัน ด้วยเหตุนี้ ระบบจึงไม่อนุญาตให้ดำเนินการบางอย่างในไดรฟ์ของฉันกับเนื้อหาในไดรฟ์ที่แชร์
คู่มือนี้จะอธิบายความแตกต่างของ API ที่เฉพาะเจาะจงไดรฟ์ที่แชร์ในทรัพยากร files
และ
changes
แหล่งข้อมูลไฟล์
ฟิลด์ต่อไปนี้ในแหล่งข้อมูล files
จะมีข้อมูล
เฉพาะไฟล์ที่อยู่ในไดรฟ์ที่แชร์เท่านั้น
hasAugmentedPermissions
: ผู้ใช้ได้รับสิทธิ์เข้าถึงไฟล์นี้โดยตรงหรือไม่
capabilities/canAddFolderFromAnotherDrive
: ผู้ใช้ปัจจุบันสามารถ
เพิ่มโฟลเดอร์จากไดรฟ์อื่น (ไดรฟ์ที่แชร์อื่นหรือไดรฟ์ของฉัน)
ไปยังโฟลเดอร์นี้ได้หรือไม่
capabilities/canDeleteChildren
: ผู้ใช้ปัจจุบันลบ
รายการย่อยของโฟลเดอร์นี้ได้หรือไม่
capabilities/canMoveChildrenOutOfDrive
: ผู้ใช้ปัจจุบันย้าย
รายการย่อยของโฟลเดอร์นี้ออกนอกไดรฟ์ที่แชร์ได้หรือไม่
capabilities/canMoveChildrenWithinDrive
: ผู้ใช้ปัจจุบันย้าย
รายการย่อยของโฟลเดอร์นี้ภายในไดรฟ์ที่แชร์ได้หรือไม่
capabilities/canMoveItemWithinDrive
: ผู้ใช้ปัจจุบันย้ายรายการในไดรฟ์ที่แชร์นี้ภายในไดรฟ์ที่แชร์ได้หรือไม่
capabilities/canReadDrive
: ผู้ใช้ปัจจุบันมีสิทธิ์เข้าถึงระดับอ่านใน
ไดรฟ์ที่แชร์ซึ่งไฟล์นี้อยู่หรือไม่
capabilities/canTrashChildren
: ผู้ใช้ปัจจุบันสามารถย้ายรายการย่อย
ของโฟลเดอร์นี้ไปที่ถังขยะได้หรือไม่
driveId
: รหัสของไดรฟ์ที่แชร์ซึ่งมีไฟล์อยู่
trashingUser
: หากมีการย้ายไฟล์ไปที่ถังขยะอย่างชัดเจน ผู้ใช้ที่ย้ายไฟล์ไปที่ถังขยะ
trashedTime
: เวลาที่รายการถูกทิ้งลงถังขยะ หากคุณใช้ Drive API v2 เวอร์ชันเก่ากว่า ฟิลด์นี้จะเรียกว่า trashedDate
ระบบจะไม่ป้อนข้อมูลในช่องต่อไปนี้สำหรับไฟล์ที่อยู่ในไดรฟ์ที่แชร์
permissions
: เนื่องจากรายการควบคุมการเข้าถึง (ACL) ของไดรฟ์ที่แชร์อาจมีขนาดใหญ่ ระบบจึงไม่แสดงสิทธิ์เป็นส่วนหนึ่งของไฟล์ ใช้permissions.list
เมธอด ซึ่งรองรับการแบ่งหน้า เพื่อแสดงสิทธิ์
สำหรับไฟล์ภายในไดรฟ์ที่แชร์หรือโฟลเดอร์ไดรฟ์ที่แชร์
owners
, ownerNames
, ownedByMe
: ไดรฟ์ที่แชร์เป็นเจ้าของไฟล์ภายในไดรฟ์ที่แชร์ ไม่ใช่ผู้ใช้แต่ละราย
folderColorRgb
: คุณจะเปลี่ยนสีโฟลเดอร์แต่ละรายการแยกกันไม่ได้
shared
: ระบบจะแชร์รายการทั้งหมดในไดรฟ์ที่แชร์
writersCanShare
: คุณจะจำกัดการแชร์ตามบทบาทในไดรฟ์ที่แชร์ไม่ได้
ระบบจะตั้งค่าช่องต่อไปนี้เมื่อผู้ใช้ได้รับสิทธิ์เข้าถึงไฟล์
ในรายการเท่านั้น
sharedWithMeDate
sharingUser
ช่องต่อไปนี้ต้องพิจารณาเป็นพิเศษเมื่อใช้กับไดรฟ์ที่แชร์
parents.isRoot
: ฟิลด์นี้จะเป็นจริงสำหรับโฟลเดอร์รูทของไดรฟ์ของฉันเท่านั้น
และจะเป็นเท็จสำหรับโฟลเดอร์ระดับบนสุดของไดรฟ์ที่แชร์
parents
: ผู้ปกครองจะไม่ปรากฏในรายชื่อผู้ปกครองหากผู้ใช้ที่ขอ
ไม่ได้เป็นสมาชิกของไดรฟ์ที่แชร์และไม่มีสิทธิ์เข้าถึง
ผู้ปกครอง นอกจากนี้ ยกเว้นโฟลเดอร์ระดับบนสุด รายการระดับบนสุดต้องมีรายการเดียวเท่านั้นหากไฟล์อยู่ในไดรฟ์ที่แชร์
capabilities/canRemoveChildren
: ใช้ capabilities/canDeleteChildren
หรือ
capabilities/canTrashChildren
เปลี่ยนแหล่งข้อมูล
ฟิลด์ใหม่ต่อไปนี้พร้อมใช้งานในแหล่งข้อมูล
changes
สำหรับไดรฟ์ที่แชร์
changeType
: ประเภทการเปลี่ยนแปลง ค่าที่เป็นไปได้คือ file
และ drive
driveId
: รหัสของไดรฟ์ที่แชร์ที่เชื่อมโยงกับการเปลี่ยนแปลงนี้
drive
: สถานะที่อัปเดตของไดรฟ์ที่แชร์ แสดงหาก changeType
เป็น drive
และผู้ใช้ยังคงเป็นสมาชิกของไดรฟ์ที่แชร์
คุณอาจต้องทำการเปลี่ยนแปลงเพิ่มเติมสำหรับแอปพลิเคชันที่ต้องซิงค์เนื้อหากับไดรฟ์ที่แชร์หรือติดตามกิจกรรม โปรดดูรายละเอียดที่หัวข้อติดตามการเปลี่ยนแปลงสำหรับผู้ใช้
และไดรฟ์ที่แชร์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Shared drive versus My Drive API differences\n\nShared drives follow different organization, sharing, and ownership models from\na My Drive. As such, some My Drive operations\naren't permitted for content in a shared drive.\n\nThis guide outlines shared drive-specific API differences in the `files` and\n`changes` resources.\n\nFile resource\n-------------\n\nThe following fields in the [`files`](/workspace/drive/api/reference/rest/v3/files) resource are\nonly populated for files located within a shared drive:\n\n- `hasAugmentedPermissions`: Whether any users are granted file access directly on this file.\n- `capabilities/canAddFolderFromAnotherDrive`: Whether the current user can add a folder from another drive (a different shared drive or My Drive) to this folder.\n- `capabilities/canDeleteChildren`: Whether the current user can delete children of this folder.\n- `capabilities/canMoveChildrenOutOfDrive`: Whether the current user can move children of this folder outside of the shared drive.\n- `capabilities/canMoveChildrenWithinDrive`: Whether the current user can move children of this folder within the shared drive.\n- `capabilities/canMoveItemWithinDrive`: Whether the current user can move this shared drive item within the shared drive.\n- `capabilities/canReadDrive`: Whether the current user has read access to the shared drive to which this file belongs.\n- `capabilities/canTrashChildren`: Whether the current user can trash children of this folder.\n- `driveId`: The ID of the shared drive where the file is located.\n- `trashingUser`: If the file has been explicitly trashed, the user who trashed it.\n- `trashedTime`: The time that the item was trashed. If you're using the older Drive API v2, this field is called `trashedDate`.\n\nThe following fields aren't populated for files located within a shared drive:\n\n- `permissions`: Due to the potential size of shared drive access control lists (ACLs), permissions aren't returned as part of files. Use the `permissions.list` method, which supports pagination, to list permissions for a file within a shared drive or the shared drive folder.\n- `owners`, `ownerNames`, `ownedByMe`: Files within a shared drive are owned by the shared drive, not individual users.\n- `folderColorRgb`: Folders cannot be colored individually.\n- `shared`: All items in a shared drive are shared.\n- `writersCanShare`: It's not possible to restrict sharing by role in shared drives.\n\nThe following fields are only set when the user has been granted file access\npermissions on an item:\n\n- `sharedWithMeDate`\n- `sharingUser`\n\nThe following fields require special consideration when you use them with shared\ndrives:\n\n- `parents.isRoot`: This field is only true for the My Drive root folder; it's false for the shared drive top-level folder.\n- `parents`: A parent doesn't appear in the parents list if the requesting\n user isn't a member of the shared drive and doesn't have access to the\n parent. In addition, with the exception of the top level folder, the parents\n list must contain exactly one item if the file is located within a shared\n drive.\n\n | **Note:** If you're using the older Drive API v2:\n | - `shareable`: Deprecated. Use `capabilities/canShare`.\n | - `editable`: Deprecated. Use `capabilities/canEdit`.\n | - `copyable`: Deprecated. Use `capabilities/canCopy`.\n | - `canComment`: Deprecated. Use `capabilities/canComment`.\n | - `canReadRevisions`: Deprecated. Use `capabilities/canReadRevisions`.\n- `capabilities/canRemoveChildren`: Use `capabilities/canDeleteChildren` or\n `capabilities/canTrashChildren`.\n\nChange resource\n---------------\n\nThe following new fields are available in the\n[`changes`](/workspace/drive/api/reference/rest/v3/changes) resource for a shared drive:\n\n- `changeType`: The change type. Possible values are `file` and `drive`.\n- `driveId`: The ID of the shared drive associated with this change.\n- `drive`: The updated state of the shared drive. Present if the `changeType` is `drive` and the user is still a member of the shared drive.\n\nAdditional changes might be required for applications that need to sync content\nwith shared drives or track activity. For details, see [Track changes for users\nand shared drives](/workspace/drive/api/guides/about-changes).\n\nRelated topics\n--------------\n\n- [Files and folders overview](/workspace/drive/api/guides/about-files)\n- [Changes and revisions overview](/workspace/drive/api/guides/change-overview)"]]