OneDrive/SharePoint — Upload
OneDrive/SharePoint — Upload
Section titled “OneDrive/SharePoint — Upload”Type: msfiles-upload · Package: OneDrive / SharePoint v1.0.5 · Output: Dictionary<string,object>
Uploads a file from the machine to a path in the drive (OneDrive or a SharePoint library) and returns its data, ID included, ready to share, move or log it. Supports files up to 250 MB.
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.
In destination give the full path inside the drive, from its root, including folders and the file name (Reports/2026/today.pdf), with / as separator. The file name in the cloud is the one in destination, not the local one, so you can rename it on upload. If the target folder does not exist yet, create it first with Create folder.
Behavior:
- If a file with that name already exists in that folder, its content is replaced (OneDrive and SharePoint keep it as a new version, so the previous one stays in the version history). That is why retrying the upload is safe.
- The file is sent whole in a single request; the limit is 250 MB and large files take as long as the robot machine’s connection needs.
- The local file is neither modified nor deleted.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the local file to upload. |
destination | string | — | Target path in the drive, from the root (folders + file name). E.g. Reports/report.pdf. |
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 uploaded file’s metadata: id, name, isFolder (false), size (bytes), webUrl, parentId, modifiedTime, createdTime and childCount (null). Access by key: uploaded["id"] (use it to share, move or download), uploaded["webUrl"] (to send the link to people who already have access).
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. |
'path' is required. / 'destination' is required. | The parameter is empty or its expression returned null. |
Local file not found. | There is no file at path on the robot’s machine. Check the path (and that it is a file, not a folder). |
accessDenied (Microsoft Graph, 403) | The connection cannot write to that drive or folder. |
invalidRequest (Microsoft Graph, 400) | The name or path has characters not allowed in OneDrive/SharePoint (" * : < > ? / \ |). |
| Microsoft Graph size error | The file is larger than 250 MB. Compress or split it before uploading. |
For large uploads or unstable networks, wrap it in Retry: since the file is replaced, repeating it does not create duplicates.
Example
Section titled “Example”OneDrive/SharePoint — Connect credential = credential("m365-operations") └─ body: OneDrive/SharePoint — Upload path = "C:\reports\today.pdf" destination = "Reports/" + DateTime.Now.ToString("yyyy-MM-dd") + ".pdf" → output: uploaded OneDrive/SharePoint — Share id = uploaded["id"] scope = organization → output: link Log message = "Report published at " + link["link"]Related activities
Section titled “Related activities”- OneDrive/SharePoint — Download — download a file.
- OneDrive/SharePoint — Create folder — create the target folder.
- OneDrive/SharePoint — Share — share the uploaded file.
- All OneDrive / SharePoint activities