Google Drive — List files
Google Drive — List files
Section titled “Google Drive — List files”Type: googledrive-list · Package: Google Drive v1.0.5 · Output: List<Dictionary<string,object>>
Lists the content of a folder or searches files and folders across Drive. It is the usual way to get the IDs the other activities need (download, move, share…), and to process in bulk whatever arrives in a folder.
How it works
Section titled “How it works”Runs one Drive query, joining with and the conditions you set:
folderId: only the direct children of that folder (rootfor the root of My Drive). It does not go into subfolders.query: a search in Driveqsyntax, e.g.name contains 'invoice',mimeType = 'application/pdf',modifiedTime > '2026-06-01T00:00:00'.- Unless you turn on
includeTrashed,trashed = falseis added to leave the trash out.
With neither folderId nor query, it lists everything the account can see (My Drive and what is shared with it). It returns up to maxResults items from a single page of results, 1000 at most, with no guaranteed order. Items in shared drives do not appear.
Required parameters
Section titled “Required parameters”None.
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGoogleDriveSession | — | Session from Google Drive — Connect. Inside Connect’s body it is inherited and you can leave it empty. |
folderId | string | — | Lists the direct children of this folder (e.g. root). If empty, searches all files. |
query | string | — | Drive query (q syntax). Combined with folderId if both are set. E.g. name contains 'invoice'. |
maxResults | int | 100 | Maximum number of items (1–1000). A non-numeric value or one below 1 uses 100. |
includeTrashed | bool | false | Include items in the trash. |
Output
Section titled “Output”Returns a List of Dictionary: each item is a file or folder with the file metadata (id, name, mimeType, isFolder, size, parents, modifiedTime, createdTime, webViewLink, trashed). If nothing matches, it returns an empty list, not an error. Loop over it with a For Each and read by key (item["name"], item["id"]).
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No Google Drive session available. Provide 'session' from a googledrive-connect activity, or place this activity inside the Connect activity's body … | The activity is outside Connect’s body and received no session. Move it inside the body or pass the saved session. |
The service drive has thrown an exception. HttpStatusCode is BadRequest… | The query has syntax Drive does not understand (unclosed quotes, unknown field). Strings go in single quotes. |
The service drive has thrown an exception. HttpStatusCode is … | Google rejected the call: unknown ID or no access, expired token or quota exceeded. See Google API errors. |
Example
Section titled “Example”Download the PDFs that arrived in a folder and file them in another:
Google Drive — Connect credential = credential("drive-operations") └─ body: Google Drive — List files folderId = inboxId query = "mimeType = 'application/pdf'" → output: pdfs For Each items = pdfs itemVariable = pdf └─ activities: Google Drive — Download id = pdf["id"] destination = "C:\inbox" → output: path Google Drive — Move id = pdf["id"] folderId = processedIdRelated activities
Section titled “Related activities”- Google Drive — Get info — data of a specific file.
- Google Drive — Download — download a file from the list.
- Google Drive — Connect — open the session.
- All Google Drive activities