Search code examples
google-drive-apigoogle-drive-shared-drive

Google Team Drive file list not showing all files


When using the v3 of Google Drive API for listing files I get either no results or an incomplete list of results when querying a team drive content.

I've double-checked:

  • the team drive permissions for the service user I am using
  • I am setting the setSupportsTeamDrives and setIncludeTeamDriveItems parameters
  • I am setting the setPageSize explicitly and am using the paging mechanism with setPageToken and getNextPageToken

Yet, the call to GoogleApiClient.drive.files.list....execute() succeeds, but returns too little results (when compared to eyeballing).

What could be wrong?

(Note the other question Incomplete Google Drive REST API results for Team Drive files is not a duplicate as the other one is about incomplete "columns", not "rows")


Solution

  • This could be avoided if you explicitly set the corpora, e.g.

         .setCorpora("teamDrive")
         .setTeamDriveId("0000REDACTED")
    

    Otherwise the list of results seems to be subjectively decided by Google with no clear criteria applied. As of moment of writing this (Nov 2018) Google documentation doesn't seem to mention the default value for the corpora when not specified.