团队云端硬盘文件的 Google Drive REST API 结果不完整

Incomplete Google Drive REST API results for Team Drive files

问题

在我的团队云端硬盘备份系统的第一阶段,我首先需要扫描给定团队云端硬盘中的文件,以确定要复制哪些文件进行备份。

I (think?) have full permissions over the files & folders of the Team Drive, due to the credentials I use (set to Owner in the cloud console).

然而,我的问题是,当我在 REST API 中查询给定团队驱动器的文件列表时,结果不符合 documentation。返回的文件对象只包含 5 个字段,它们是:

根据提供的文档,我应该会收到更多字段。

下面是我用来查询 API 和输出的代码。

简化来源

credentials = get_credentials() # retrieves and processes app credentials
drive = get_drive_api(credentials) # get the drive API v3 using httplib2 and discovery
query = drive.files().list(
    pageSize = 10,
    corpora = 'teamDrive',
    supportsTeamDriveItems = True,
    includeTeamDrives = True,
    teamDriveId = "..."
)
results = query.execute() # contact the REST API
files = results.get('files', [])
for file in files:
    print(file)

对于给定的团队云端硬盘,输出为

{
  'kind': 'drive#file',
  'id': '...',
  'name': 'filename',
  'mimeType': 'application/vnd.google-apps.document',
  'teamDriveId': '...'
}

这显然不是 docs 的预期输出。

我没有得到完整的预期数据的原因有什么见解吗?

With Google Drive API v3 full resources are no longer returned by default. Use the fields query parameter to request specific fields to be returned. If left unspecified only a subset of commonly used fields are returned.

要获取资源的所有可用字段,您可以将 fields 设置为 *

例如:

query = drive.files().list(
    pageSize = 10,
    corpora = 'teamDrive',
    supportsTeamDriveItems = True,
    includeTeamDrives = True,
    teamDriveId = "...",
    fields="*"  # or maybe "files(id,name,capabilities/canShare),nextPageToken"
)