Google Drive — Get info
Google Drive — Get info
Section titled “Google Drive — Get info”Type: googledrive-get-info · Package: Google Drive v1.0.5 · Output: Dictionary<string,object>
Gets the metadata of a file or folder from its ID: name, type, size, dates, the folders that contain it and its link. Use it when you already have the ID and want to check its data before acting, for example whether it still exists or changed since the last run.
How it works
Section titled “How it works”Queries Drive by id. It only reads: nothing is changed. It also returns items that are in the trash (with trashed = true).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | File or folder ID. |
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. |
Output
Section titled “Output”Returns a Dictionary with the item metadata: info["name"], info["mimeType"], info["isFolder"], info["size"] (bytes; null for folders and Google documents), info["webViewLink"], info["modifiedTime"], info["parents"], info["trashed"]…
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'id' is required. | id is empty or its expression returned null. |
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 NotFound… | The ID does not exist or the account has no access. To check whether a file exists without stopping the process, wrap it in Try / Catch. |
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”Google Drive — Connect credential = credential("drive-operations") └─ body: Google Drive — Get info id = fileId → output: info If condition = eq(info["isFolder"], false) && eq(info["trashed"], false) └─ then: Log message = info["name"] + " — " + info["size"] + " bytes, modified " + info["modifiedTime"]Related activities
Section titled “Related activities”- Google Drive — List files — search files and their IDs.
- Google Drive — Download — download the file.
- Google Drive — Rename — rename it.
- All Google Drive activities