OneDrive Block
Create, upload, and list files
The OneDrive block integrates Microsoft OneDrive into your workflows so you can manage files and folders directly. Use it to upload new files, create folders, and list folder contents over OAuth, with support for folder organization and name-based search.
Overview
| Property | Value |
|---|---|
| Type | onedrive |
| Category | tools |
| Color | #E0E0E0 |
When to Use
- Upload generated content or reports to a specific OneDrive folder as a new file.
- Create new folders to organize files and artifacts produced by a workflow.
- List the contents of a folder (or the root drive) to drive downstream processing.
- Search a folder for specific files by name prefix before acting on them.
- Persist workflow outputs to a user's Microsoft account using OAuth credentials.
- Automate OneDrive file management as part of a larger multi-step agent workflow.
Configuration
Operation
Selects which action the block performs. Choose one of:
| Label | ID |
|---|---|
| Create Folder | create_folder |
| Upload File | upload |
| List Files | list |
Microsoft Account (credential)
OAuth credential for the connected Microsoft / OneDrive account. Required for all operations. Uses scopes openid, profile, email, Files.Read, Files.ReadWrite, and offline_access.
File Name (fileName) — Upload only
The name for the file to upload. The tool always stores content as a .txt file; any existing extension is replaced with .txt.
Content (content) — Upload only
The text content to write into the uploaded file.
Select Parent Folder (folderSelector) — Upload and Create Folder
A folder picker (basic mode) that lets you browse and select the destination parent folder. Leave unset to target the root drive.
Parent Folder ID (manualFolderId) — Upload, Create Folder, and List (advanced mode)
Manually supply the Microsoft Graph folder ID. Available in advanced mode for all three operations. Leave empty to target the root folder.
Folder Name (folderName) — Create Folder only
The name for the new folder that will be created. If a folder with that name already exists, Microsoft Graph renames the new folder automatically.
Select Folder (folderSelector) — List only
A folder picker (basic mode) that selects the folder whose contents will be listed.
Search Query (query) — List only
Optional name-prefix filter. Returns only items whose names start with the supplied string (e.g., report matches report-2024.txt).
Results Per Page (pageSize) — List only
Maximum number of items to return. Defaults to 100; maximum is 1000.
Inputs & Outputs
-
Inputs:
operation(string) — Operation to perform (upload,create_folder, orlist)credential(string) — Microsoft account OAuth credential (access token)fileName(string) — File name (upload operation)content(string) — File content (upload operation)folderSelector(string) — Folder selector picked via UI (basic mode; used by upload, create_folder, and list)manualFolderId(string) — Parent or target folder ID entered manually (advanced mode)query(string) — Name-prefix search query (list operation)pageSize(number) — Number of results per page (list operation)
-
Outputs:
file(json) — The OneDrive file or folder object returned by create_folder and upload operations; includesid,name,mimeType,webViewLink,webContentLink,size,createdTime,modifiedTime, andparentReferencefiles(json) — Array of OneDrive file/folder objects returned by the list operation; each item containsid,name,mimeType,webViewLink,webContentLink,size,createdTime,modifiedTime, andparents
Tools
- Upload to OneDrive (
onedrive_upload) — Uploads text content to OneDrive as a.txtfile using Microsoft GraphPUT /me/drive/items/{folderId}:/{fileName}:/content. Places the file in the specified parent folder or at the root if no folder is given. Returns the uploaded file's metadata. - Create Folder in OneDrive (
onedrive_create_folder) — Creates a new folder under the specified parent folder (or at the root) using Microsoft GraphPOST /me/drive/items/{folderId}/children. Handles name conflicts by automatically renaming the new folder. Returns the created folder's metadata. - List OneDrive Files (
onedrive_list) — Lists files and folders inside a specified folder (or the root) using Microsoft GraphGET /me/drive/items/{folderId}/children. Supports name-prefix filtering via$filterand pagination via$top. Returns an array of file/folder objects and an optionalnextPageTokenfor retrieving subsequent pages.
YAML Example
onedrive_1:
type: onedrive
name: "OneDrive"
inputs:
operation: "upload"
credential: "{{credentials.onedrive}}"
fileName: "report"
content: "{{start.input}}"
manualFolderId: ""
connections:
outgoing:
- target: next-block-id