Skip to content

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.

Runs one Drive query, joining with and the conditions you set:

  • folderId: only the direct children of that folder (root for the root of My Drive). It does not go into subfolders.
  • query: a search in Drive q syntax, e.g. name contains 'invoice', mimeType = 'application/pdf', modifiedTime > '2026-06-01T00:00:00'.
  • Unless you turn on includeTrashed, trashed = false is 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.

None.

ParameterTypeDefaultDescription
sessionZoanGoogleDriveSession—Session from Google Drive — Connect. Inside Connect’s body it is inherited and you can leave it empty.
folderIdstring—Lists the direct children of this folder (e.g. root). If empty, searches all files.
querystring—Drive query (q syntax). Combined with folderId if both are set. E.g. name contains 'invoice'.
maxResultsint100Maximum number of items (1–1000). A non-numeric value or one below 1 uses 100.
includeTrashedboolfalseInclude items in the trash.

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"]).

MessageCause 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.

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 = processedId