It is not possible to make an API call to get all the files in your domain in one go. It is nice to remember that the folder or files needs to be shared with the service account. If false, then shared drive items are not included in the response.Įxample service.files().list(includeItemsFromAllDrives=True, supportsAllDrives=True, pageSize=10, fields="nextPageToken, files(id, name,modifiedTime)").execute() SupportsAllDrives - Whether the requesting application supports both My Drives and shared drives. Prefer user or drive to allDrives for efficiency.
Supported bodies are user, domain, drive, and allDrives.
If not present or set to false, then shared drive items are not returned.Ĭorpora - Bodies of items (files/documents) to which the query applies. IncludeItemsFromAllDrives - Whether shared drive items should be included in results. The files.list method contains the following shared drive-specific fields and query modes: To search for shared drive, refer to Search for files and folders. This section covers shared drive-specific fields in the files.list method. Use the files.list method to search for shared drives. To begin, you need to include the supportsAllDrives=true query parameter in your requests when your app performs these operations:įiles.get, files.list, files.create, files.update, py, lete, changes.list, changes.getStartPageToken, permissions.list, permissions.get, permissions.create, permissions.update, lete Search for content on a shared drive If your app is going to create and manage files on shared drives, you must implement shared drive support in your app. Shared drives follow different organization, sharing, and ownership models from My Drive.
I was able to list shared drive files without impersonating a user by adding some parameters to the list method as stated on google documentation: Implement shared drive support PS: I have seen this: Getting files from shared folder but it does not help Results = service.files().list(pageSize=10, fields="nextPageToken, files(id, name,modifiedTime)").execute() Service = discovery.build('drive', 'v3', credentials=credentials) Ĭredentials = service_service_account_file(secret_cred_file, scopes=SCOPES) The email address of the service account has been properly added to all folders in the shared drive.Īny idea? Basically all I need is to know when is the last time a sheet was modified by any given user. The account has access to all Cloud APIs, has Domain-wide Delegation with all scopes related to Drive API included in the API control menu in GSuite. However, when I use the same service account for the Drive API, it does not return any info on files outside its own folder (which contains only one file: "Getting Started"). I have created a service account in the GCP Drive API menu and it can access/edit/etc Google Sheets without any problem the via the Sheets API. The last time a Google Sheets file on a shared drive was modified. I have been trying to access some simple information on Google Shared Drive files from a Python 3.7 script: