Różnice między interfejsem My Drive API a dyskami współdzielonymi
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Dyski współdzielone mają inne modele organizacji, udostępniania i własności niż Mój dysk. Dlatego w przypadku treści na dysku współdzielonym niektóre operacje na Moim dysku są niedozwolone.
W tym przewodniku opisujemy różnice w interfejsie API dotyczące dysków współdzielonych w zasobach files
i changes
.
Zasób pliku
Te pola w zasobie files
są wypełniane tylko w przypadku plików znajdujących się na dysku współdzielonym:
hasAugmentedPermissions
: Czy użytkownicy mają bezpośredni dostęp do tego pliku.
capabilities/canAddFolderFromAnotherDrive
: czy bieżący użytkownik może dodać do tego folderu folder z innego dysku (innego dysku współdzielonego lub Mojego dysku).
capabilities/canDeleteChildren
: Określa, czy obecny użytkownik może usuwać podfoldery tego folderu.
capabilities/canMoveChildrenOutOfDrive
: czy bieżący użytkownik może przenosić elementy podrzędne tego folderu poza dysk współdzielony.
capabilities/canMoveChildrenWithinDrive
: czy bieżący użytkownik może przenosić elementy podrzędne tego folderu na dysku współdzielonym.
capabilities/canMoveItemWithinDrive
: czy bieżący użytkownik może przenieść ten element dysku współdzielonego w obrębie dysku współdzielonego.
capabilities/canReadDrive
: Czy bieżący użytkownik ma uprawnienia do odczytu dysku współdzielonego, do którego należy ten plik.
capabilities/canTrashChildren
: Określa, czy bieżący użytkownik może przenieść do kosza elementy podrzędne tego folderu.
driveId
: identyfikator dysku współdzielonego, na którym znajduje się plik.
trashingUser
: jeśli plik został wyraźnie przeniesiony do kosza, użytkownik, który to zrobił.
trashedTime
: czas przeniesienia elementu do kosza. Jeśli używasz starszej wersji interfejsu Drive API v2, to pole nazywa się trashedDate
.
W przypadku plików znajdujących się na dysku współdzielonym nie są wypełniane te pola:
permissions
: Ze względu na potencjalny rozmiar list kontroli dostępu (ACL) do dysków współdzielonych uprawnienia nie są zwracane jako część plików. Użyj metody
permissions.list
, która obsługuje stronicowanie, aby wyświetlić listę uprawnień
do pliku na dysku współdzielonym lub w folderze dysku współdzielonego.
owners
, ownerNames
, ownedByMe
: pliki na dysku współdzielonym są własnością dysku współdzielonego, a nie poszczególnych użytkowników.
folderColorRgb
: Nie można kolorować poszczególnych folderów.
shared
: Wszystkie elementy na dysku współdzielonym są udostępniane.
writersCanShare
: nie można ograniczyć udostępniania według roli na dyskach współdzielonych.
Poniższe pola są ustawiane tylko wtedy, gdy użytkownik ma uprawnienia dostępu do pliku w przypadku danego elementu:
sharedWithMeDate
sharingUser
Jeśli używasz dysków współdzielonych, zwróć szczególną uwagę na te pola:
parents.isRoot
: to pole ma wartość „true” tylko w przypadku folderu głównego Mojego dysku, a w przypadku folderu najwyższego poziomu na dysku współdzielonym ma wartość „false”.
parents
: rodzic nie pojawia się na liście rodziców, jeśli użytkownik wysyłający żądanie nie jest członkiem dysku współdzielonego i nie ma dostępu do rodzica. Dodatkowo, z wyjątkiem folderu najwyższego poziomu, lista elementów nadrzędnych musi zawierać dokładnie 1 element, jeśli plik znajduje się na dysku współdzielonym.
capabilities/canRemoveChildren
: użyj capabilities/canDeleteChildren
lub capabilities/canTrashChildren
.
Zmień zasób
W zasobie changes
dysku współdzielonego są dostępne te nowe pola:
changeType
: typ zmiany. Możliwe wartości to file
i drive
.
driveId
: identyfikator dysku współdzielonego powiązanego z tą zmianą.
drive
: zaktualizowany stan dysku współdzielonego. Występuje, jeśli changeType
ma wartość drive
, a użytkownik nadal jest użytkownikiem dysku współdzielonego.
W przypadku aplikacji, które muszą synchronizować treści z dyskami współdzielonymi lub śledzić aktywność, mogą być wymagane dodatkowe zmiany. Więcej informacji znajdziesz w artykule Śledzenie zmian użytkowników i dysków współdzielonych.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-29 UTC.
[null,null,["Ostatnia aktualizacja: 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)"]]