共用雲端硬碟與 My Drive API 的差異
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
共用雲端硬碟的組織、共用和擁有權模式與「我的雲端硬碟」不同。因此,您無法對共用雲端硬碟中的內容執行部分「我的雲端硬碟」作業。
本指南將說明 files
和 changes
資源中,共用雲端硬碟專屬的 API 差異。
檔案資源
files
資源中的下列欄位只會填入共用雲端硬碟中的檔案:
hasAugmentedPermissions
:是否有任何使用者直接取得這個檔案的存取權。
capabilities/canAddFolderFromAnotherDrive
:目前使用者是否可將其他雲端硬碟 (其他共用雲端硬碟或「我的雲端硬碟」) 中的資料夾新增至這個資料夾。
capabilities/canDeleteChildren
:目前使用者是否可以刪除這個資料夾的子項。
capabilities/canMoveChildrenOutOfDrive
:目前使用者是否可將這個資料夾的子項移出共用雲端硬碟。
capabilities/canMoveChildrenWithinDrive
:目前使用者是否可以在共用雲端硬碟中移動這個資料夾的子項。
capabilities/canMoveItemWithinDrive
:目前使用者是否可以在共用雲端硬碟中移動這個項目。
capabilities/canReadDrive
:目前使用者是否具有檔案所屬共用雲端硬碟的讀取權限。
capabilities/canTrashChildren
:目前使用者是否可以將這個資料夾的子項移至垃圾桶。
driveId
:檔案所在的共用雲端硬碟 ID。
trashingUser
:如果檔案已明確移至垃圾桶,則為移至垃圾桶的使用者。
trashedTime
:項目遭刪除的時間。如果您使用的是舊版 Drive API v2,這個欄位稱為 trashedDate
。
如果檔案位於共用雲端硬碟中,系統不會填入下列欄位:
permissions
:由於共用雲端硬碟存取控制清單 (ACL) 可能很大,因此權限不會做為檔案的一部分傳回。使用 permissions.list
方法 (支援分頁),列出共用雲端硬碟或共用雲端硬碟資料夾中檔案的權限。
owners
、ownerNames
、ownedByMe
:共用雲端硬碟中的檔案歸共用雲端硬碟所有,而非個別使用者。
folderColorRgb
:資料夾無法個別上色。
shared
:共用雲端硬碟中的所有項目都會共用。
writersCanShare
:您無法在共用雲端硬碟中依角色限制共用。
只有在使用者獲得項目的檔案存取權時,系統才會設定下列欄位:
sharedWithMeDate
sharingUser
與共用雲端硬碟搭配使用時,請特別注意下列欄位:
變更資源
共用雲端硬碟的 changes
資源現在提供下列新欄位:
changeType
:變更類型。可能的值為 file
和 drive
。
driveId
:與這項變更相關聯的共用雲端硬碟 ID。
drive
:共用雲端硬碟的更新狀態。如果 changeType
且使用者仍是共用雲端硬碟的成員,則會顯示。drive
如果應用程式需要與共用雲端硬碟同步處理內容或追蹤活動,可能需要進行額外變更。詳情請參閱「追蹤使用者和共用雲端硬碟的變更」。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],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)"]]