OneDrive & SharePoint Activities
OneDrive & SharePoint Activities
Section titled “OneDrive & SharePoint Activities”Version: 1.0.5 · ID: zoan-packages-msfiles · Author: Zoan Software
The OneDrive / SharePoint package manages files (upload, download, search, move, share) and also SharePoint list items (read, add, update, delete) through Microsoft Graph. It works directly on the Microsoft 365 cloud, with no sync client or mapped drives on the robot’s machine.
Concept 1: authentication and permissions
Section titled “Concept 1: authentication and permissions”The activities authenticate with a Microsoft 365 OAuth connection from Zoan Cloud. In Connect you reference it with the credential() function and its key name:
OneDrive/SharePoint — Connect credential = credential("m365-operations")Zoan Cloud hands the activity a valid access token (and renews it on its own). When you create the connection, select the Microsoft Graph permissions (scopes) your activities need:
| Microsoft Graph permission | What it is for |
|---|---|
Files.ReadWrite | Files in the OneDrive of the account that authorized the connection. |
Files.ReadWrite.All | Files of other users (mailbox), shared with the account or in SharePoint libraries. |
Sites.ReadWrite.All | SharePoint document libraries (driveId) and SharePoint lists (siteId). |
offline_access | Lets Zoan Cloud renew the token without asking for consent again. |
If the process only reads, the equivalent .Read permissions are enough (Files.Read, Files.Read.All, Sites.Read.All). The connection acts as the account that authorized it: it can only see and change what that account can see and change in Microsoft 365.
Concept 2: how drives, files, sites and lists are identified
Section titled “Concept 2: how drives, files, sites and lists are identified”| What | How you give it | Where it comes from |
|---|---|---|
| Drive (OneDrive or library) | driveId in Connect. Without it, the OneDrive of the connection’s account (or of mailbox). | For a SharePoint library, Microsoft Graph returns its ID at /sites/{siteId}/drives. |
| File or folder | By ID (id, folderId) in almost every activity. | The id key returned by List files, Upload, Create folder, Get info and Move. |
| Path | Only in Upload (destination): path from the drive root, Reports/2026/summary.pdf. | You write it. |
| SharePoint site | siteId in Connect. Only the list activities need it. | Microsoft Graph returns it at /sites/{host}:/sites/{name}; it looks like contoso.sharepoint.com,<guid>,<guid>. |
| List | list: display name or ID of the list. | The name you see in SharePoint, or the list ID. |
| List item | itemId. | The id key returned by Get list items and Add list item. |
driveId and siteId are independent: with siteId the lists point to the site, but files stay in the driveId drive (or in OneDrive if you do not give one). To work with a site’s files, also pass its library’s driveId.
Concept 3: the session
Section titled “Concept 3: the session”All operations work on the session opened by Connect:
- With
body: the activities you place inside inherit the session, and it closes on its own when the block ends. - Without
body: Connect returns the session; pass it throughsessionto the other activities and close it with Close.
Concept 4: output shapes
Section titled “Concept 4: output shapes”File activities return each item’s metadata as a Dictionary<string,object> with these keys:
| Key | Type | Content |
|---|---|---|
id | string | File or folder ID. This is what the other activities ask for. |
name | string | Name with extension. |
isFolder | bool | true if it is a folder. |
size | number | Size in bytes (for folders, the total of their content). |
webUrl | string | Address to open it in the browser (requires access). |
parentId | string | ID of the folder that contains it. |
modifiedTime | string | Last modified date, ISO 8601 in UTC (2026-10-15T14:03:22.0000000+00:00). |
createdTime | string | Creation date, same format. |
childCount | number | Number of items inside (folders only; null for files). |
List files returns a list of these dictionaries; Get list items returns a list of { id, fields }, where fields is a dictionary with the list columns by internal name.
Concept 5: API errors
Section titled “Concept 5: API errors”Besides each activity’s own validations, Microsoft Graph can reject an operation. The error carries the message and code returned by Microsoft:
| Microsoft Graph code | Usual cause | What to do |
|---|---|---|
InvalidAuthenticationToken (401) | The credential value is not a valid token (for example, the connection name was written without credential()), or the token expired. | Use credential("key-name") and check that the connection is Connected in Zoan Cloud. |
accessDenied (403) | The connection is missing a permission, the account has no access to the item, or an organization policy prevents it (for example, anonymous links disabled). | Add the permission to the connection and reconnect it, or ask for access to the item. |
itemNotFound (404) | The ID, path, drive, site or list does not exist (or is in a different drive from the session’s). | Check the ID and Connect’s driveId/siteId. |
nameAlreadyExists (409) | An item with that name already exists in the target folder. | Use another name or delete the existing one first. |
invalidRequest (400) | An invalid value: a name with disallowed characters, a list column that does not exist, an unsupported conversion format. | Check the values sent. |
| 429, 503 or 504 | Microsoft is temporarily throttling requests or the service is not responding. | Wrap the activity in a Retry with a delay between attempts. |
To keep the process going after a failure, use Try / Catch.
Activities
Section titled “Activities”Files (OneDrive / SharePoint)
Section titled “Files (OneDrive / SharePoint)”| Activity | Type | Output | Description |
|---|---|---|---|
| OneDrive/SharePoint — Connect | msfiles-connect | ZoanMicrosoftFilesSession | Opens a OneDrive / SharePoint session through Microsoft Graph |
| OneDrive/SharePoint — Upload | msfiles-upload | Dictionary<string,object> | Uploads a local file to a path in the drive (up to 250 MB) |
| OneDrive/SharePoint — Download | msfiles-download | string | Downloads a file to a local path; can export Office documents to PDF |
| OneDrive/SharePoint — List files | msfiles-list | List<Dictionary<string,object>> | Lists a folder’s content or searches by text |
| OneDrive/SharePoint — Get info | msfiles-get-info | Dictionary<string,object> | Gets the metadata of a file or folder by its ID |
| OneDrive/SharePoint — Create folder | msfiles-create-folder | Dictionary<string,object> | Creates a folder |
| OneDrive/SharePoint — Copy | msfiles-copy | — | Copies a file or folder |
| OneDrive/SharePoint — Move | msfiles-move | Dictionary<string,object> | Moves (and optionally renames) a file or folder |
| OneDrive/SharePoint — Share | msfiles-share | Dictionary<string,object> | Shares a file or folder: creates a link or invites by email |
| OneDrive/SharePoint — Delete | msfiles-delete | — | Deletes a file or folder (moves it to the recycle bin) |
| OneDrive/SharePoint — Close | msfiles-close | — | Closes a OneDrive/SharePoint session |
SharePoint lists
Section titled “SharePoint lists”| Activity | Type | Output | Description |
|---|---|---|---|
| SharePoint — Get list items | msfiles-get-list-items | List<Dictionary<string,object>> | Reads the items of a SharePoint list (with their fields) |
| SharePoint — Add list item | msfiles-add-list-item | string | Adds an item to a SharePoint list |
| SharePoint — Update list item | msfiles-update-list-item | — | Updates the fields of a SharePoint list item |
| SharePoint — Delete list item | msfiles-delete-list-item | — | Deletes an item from a SharePoint list |