OneDrive/SharePoint — Get info
OneDrive/SharePoint — Get info
Section titled “OneDrive/SharePoint — Get info”Type: msfiles-get-info · Package: OneDrive / SharePoint v1.0.5 · Output: Dictionary<string,object>
Gets the metadata of a file or folder from its ID: name, type, size, dates and link. Use it when you already have the ID and want to check its data before acting, for example whether it changed since the last run.
How it works
Section titled “How it works”It works on the session created with OneDrive/SharePoint — Connect. Pass it in the session parameter, or place this activity inside the body of Connect to inherit it automatically.
It looks up the item in the session’s drive. It is read-only and does not download the content.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | ID of the file or folder in the drive. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanMicrosoftFilesSession | — | Connect session. Inherited inside Connect’s body. |
Output
Section titled “Output”Returns a Dictionary<string,object> with the item’s data:
| Key | Content |
|---|---|
id | Item ID. |
name | Name with extension. |
isFolder | true if it is a folder. |
size | Size in bytes. |
webUrl | Address to open it in the browser. |
parentId | ID of the folder that contains it. |
modifiedTime / createdTime | ISO 8601 dates in UTC, as text. |
childCount | Items it contains (folders only; null for files). |
Access by key: info["name"], info["size"]. To compare dates, convert them with DateTimeOffset.Parse(info["modifiedTime"].ToString()).
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No OneDrive/SharePoint session available. Provide 'session' from an msfiles-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically. | The activity is outside Connect’s body and did not receive session. Place it inside the body or pass session = session. |
'id' is required. | id is empty or its expression returned null. |
itemNotFound (Microsoft Graph, 404) / Item not found. | There is no item with that ID in the session’s drive (or it was deleted). To check whether a file exists without stopping the process, wrap it in Try / Catch. |
Example
Section titled “Example”OneDrive/SharePoint — Connect credential = credential("m365-operations") └─ body: OneDrive/SharePoint — Get info id = reportId → output: info If condition = Convert.ToInt64(info["size"]) > 20000000 └─ then: Log level = warning message = info["name"] + " is larger than 20 MB"Related activities
Section titled “Related activities”- OneDrive/SharePoint — List files — search files and their IDs.
- OneDrive/SharePoint — Download — download the file.
- OneDrive/SharePoint — Move — move or rename.
- All OneDrive / SharePoint activities