Skip to content

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.

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 permissionWhat it is for
Files.ReadWriteFiles in the OneDrive of the account that authorized the connection.
Files.ReadWrite.AllFiles of other users (mailbox), shared with the account or in SharePoint libraries.
Sites.ReadWrite.AllSharePoint document libraries (driveId) and SharePoint lists (siteId).
offline_accessLets 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”
WhatHow you give itWhere 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 folderBy ID (id, folderId) in almost every activity.The id key returned by List files, Upload, Create folder, Get info and Move.
PathOnly in Upload (destination): path from the drive root, Reports/2026/summary.pdf.You write it.
SharePoint sitesiteId 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>.
Listlist: display name or ID of the list.The name you see in SharePoint, or the list ID.
List itemitemId.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.

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 through session to the other activities and close it with Close.

File activities return each item’s metadata as a Dictionary<string,object> with these keys:

KeyTypeContent
idstringFile or folder ID. This is what the other activities ask for.
namestringName with extension.
isFolderbooltrue if it is a folder.
sizenumberSize in bytes (for folders, the total of their content).
webUrlstringAddress to open it in the browser (requires access).
parentIdstringID of the folder that contains it.
modifiedTimestringLast modified date, ISO 8601 in UTC (2026-10-15T14:03:22.0000000+00:00).
createdTimestringCreation date, same format.
childCountnumberNumber 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.

Besides each activity’s own validations, Microsoft Graph can reject an operation. The error carries the message and code returned by Microsoft:

Microsoft Graph codeUsual causeWhat 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 504Microsoft 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.

ActivityTypeOutputDescription
OneDrive/SharePoint — Connectmsfiles-connectZoanMicrosoftFilesSessionOpens a OneDrive / SharePoint session through Microsoft Graph
OneDrive/SharePoint — Uploadmsfiles-uploadDictionary<string,object>Uploads a local file to a path in the drive (up to 250 MB)
OneDrive/SharePoint — Downloadmsfiles-downloadstringDownloads a file to a local path; can export Office documents to PDF
OneDrive/SharePoint — List filesmsfiles-listList<Dictionary<string,object>>Lists a folder’s content or searches by text
OneDrive/SharePoint — Get infomsfiles-get-infoDictionary<string,object>Gets the metadata of a file or folder by its ID
OneDrive/SharePoint — Create foldermsfiles-create-folderDictionary<string,object>Creates a folder
OneDrive/SharePoint — Copymsfiles-copy—Copies a file or folder
OneDrive/SharePoint — Movemsfiles-moveDictionary<string,object>Moves (and optionally renames) a file or folder
OneDrive/SharePoint — Sharemsfiles-shareDictionary<string,object>Shares a file or folder: creates a link or invites by email
OneDrive/SharePoint — Deletemsfiles-delete—Deletes a file or folder (moves it to the recycle bin)
OneDrive/SharePoint — Closemsfiles-close—Closes a OneDrive/SharePoint session
ActivityTypeOutputDescription
SharePoint — Get list itemsmsfiles-get-list-itemsList<Dictionary<string,object>>Reads the items of a SharePoint list (with their fields)
SharePoint — Add list itemmsfiles-add-list-itemstringAdds an item to a SharePoint list
SharePoint — Update list itemmsfiles-update-list-item—Updates the fields of a SharePoint list item
SharePoint — Delete list itemmsfiles-delete-list-item—Deletes an item from a SharePoint list