Skip to content

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.

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.

ParameterTypeDefaultDescription
idstring—ID of the file or folder in the drive.
ParameterTypeDefaultDescription
sessionZoanMicrosoftFilesSession—Connect session. Inherited inside Connect’s body.

Returns a Dictionary<string,object> with the item’s data:

KeyContent
idItem ID.
nameName with extension.
isFoldertrue if it is a folder.
sizeSize in bytes.
webUrlAddress to open it in the browser.
parentIdID of the folder that contains it.
modifiedTime / createdTimeISO 8601 dates in UTC, as text.
childCountItems 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()).

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