PyDrive icon indicating copy to clipboard operation
PyDrive copied to clipboard

Shared Drive Metadata Fetch Unsupported

Open 7mt opened this issue 4 years ago • 2 comments

The Handling Special Metadata section of the docs highlights the following use case of the FetchMetadata() function:

file1 = drive.CreateFile({'id': '<some file ID here>'})

# Fetches all basic metadata fields, including file size, last modified etc.
file1.FetchMetadata()

However, this does not work if file1 is a shared drive. When file1 is a shared drive,

shared_drive = client.CreateFile({'teamDriveId': shared_drive_id})
print(shared_drive['id'])

returns a GoogleDriveFile object with blank metadata (i.e. no 'id' field). Therefore, when file_id = self.metadata.get('id') or self.get('id') is executed in the FetchMetadata function, file_id is None and FileNotUploadedError() is raised.

This error propagates into other functions that call FetchMetadata (e.g. GetPermissions()).

7mt avatar Apr 27 '21 14:04 7mt

@7mt could you check if it is fixed in the PyDrive2 (a maintainer fork)?

shcheklein avatar Apr 27 '21 14:04 shcheklein

Hi @shcheklein, just tested in PyDrive2 and I'm getting the same error.

7mt avatar Apr 27 '21 14:04 7mt