Reference · Tools

Microsoft OneDrive

Manage files and folders in Microsoft OneDrive. Upload, download, copy, delete, rename, search, and share files and folders via the Microsoft Graph API.

Action (binary) Data & Storage v1 Binary data

The Microsoft OneDrive node manages files and folders through Microsoft Graph — uploading, downloading, copying, deleting, renaming, searching and sharing. A typical build is filing each incoming email attachment into a dated OneDrive folder and returning a share link.

Node type
Action (binary)
Parameters
33
Outputs
Output, Error
Credentials
Microsoft OAuth2

Microsoft OneDrive

Manage files and folders in Microsoft OneDrive

Overview

Full file and folder management through the Microsoft Graph API, across two resources. File operations cover upload (binary or text content, up to 4 MB), download, copy, delete, get metadata, rename, search, and share-link creation. Folder operations cover create (including nested paths), delete, list contents, rename, search, and share. Downloads produce binary data on the output item; uploads consume binary data from an upstream node. Authentication is OAuth2, with tokens refreshed automatically.

Category: Data & Storage
Tool Name: microsoft_onedrive
Version: 1

Appearance: Icon: lucide-HardDrive | Color: #0078D4

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires Microsoft OAuth2 credentials. See the Credentials Guide for setup instructions.

Resources

ResourceValue
Filefile
Folderfolder

Operations

File operations come first, then folder operations. Four names are shared between the two resources; the Resource selector decides which applies.

OperationValueDescription
CopycopyCopy a file
DeletedeleteDelete a file
DownloaddownloadDownload a file
GetgetGet file metadata
RenamerenameRename a file
SearchsearchSearch for files
ShareshareCreate a sharing link for a file
UploaduploadUpload a file (up to 4MB)
CreatecreateCreate a folder
DeletedeleteDelete a folder
Get ChildrengetChildrenGet items inside a folder
RenamerenameRename a folder
SearchsearchSearch for folders
ShareshareCreate a sharing link for a folder

Parameters

File: Copy

ParameterTypeRequiredDefaultDescription
File IDstringYesID of the file to copy. Supports expressions like {{ $json.fileId }}.
Additional FieldscollectionNo{}Extra properties to apply to the copy.
— NamestringNoThe new name for the copy. If not provided, the same name will be used as the original.
Parent ReferencecollectionNo{}Reference to the parent item the copy will be created in.
— Drive IDstringNoIdentifier of the drive instance that contains the item.
— Drive TypestringNoIdentifies the type of drive.
— IDstringNoIdentifier of the target folder in the drive.
— List IDstringNoIdentifier of the list.
— NamestringNoThe name of the item being referenced.
— PathstringNoPath that can be used to navigate to the item.
— Share IDstringNoIdentifier for a shared resource accessible via the Shares API.
— Site IDstringNoIdentifier of the site.

File: Delete

ParameterTypeRequiredDefaultDescription
File IDstringYesID of the file to delete. Supports expressions.

File: Download

ParameterTypeRequiredDefaultDescription
File IDstringYesID of the file to download. Supports expressions.
Binary PropertystringYesdataName of the binary property to write the downloaded file to. Names are case-sensitive — see the upstream node’s Binary Data panel for the exact names to use.

File: Get

ParameterTypeRequiredDefaultDescription
File IDstringYesID of the file to retrieve metadata for. Supports expressions.

File: Rename

ParameterTypeRequiredDefaultDescription
Item IDstringYesID of the file to rename. Supports expressions.
New NamestringYesNew name for the file. Supports expressions.
ParameterTypeRequiredDefaultDescription
QuerystringYesThe query text used to search for files. Values may be matched across filenames, metadata, and file content.

File: Share

ParameterTypeRequiredDefaultDescription
File IDstringYesID of the file to share. Supports expressions.
TypeoptionsYesviewThe type of sharing link to create.
Options: view, edit, embed
ScopeoptionsYesanonymousWho can use the sharing link.
Options: anonymous, organization

File: Upload

ParameterTypeRequiredDefaultDescription
Parent IDstringYesID of the destination folder to upload the file into. Supports expressions.
File NamestringNoThe name the file should be saved as. For binary upload, falls back to the binary data filename if not set. For text upload, this is required.
Binary FilebooleanYestrueWhether to upload binary data from a binary property (true) or text content (false).
Binary PropertystringYesdataName of the binary property containing the file to upload. Names are case-sensitive — see the upstream node’s Binary Data panel for the exact names to use. (shown when Binary File is true)
File ContentstringYesThe text content to upload as a file. Supports expressions. (shown when Binary File is false)

Folder: Create

ParameterTypeRequiredDefaultDescription
NamestringYesThe name or slash-separated path of the folder to create (e.g., /Reports/2024 creates nested folders).
OptionscollectionNo{}Where to create the folder.
— Parent Folder IDstringNoID of the parent folder to create the new folder in. If empty, creates under drive root.

Folder: Delete

ParameterTypeRequiredDefaultDescription
Folder IDstringYesID of the folder to delete. Supports expressions.

Folder: Get Children

ParameterTypeRequiredDefaultDescription
Folder IDstringYesID of the folder to list contents of. Supports expressions.

Folder: Rename

ParameterTypeRequiredDefaultDescription
Item IDstringYesID of the folder to rename. Supports expressions.
New NamestringYesNew name for the folder. Supports expressions.
ParameterTypeRequiredDefaultDescription
QuerystringYesThe query text used to search for folders. Values may be matched across folder names and metadata.

Folder: Share

ParameterTypeRequiredDefaultDescription
Folder IDstringYesID of the folder to share. Supports expressions.
TypeoptionsYesviewThe type of sharing link to create.
Options: view, edit, embed
ScopeoptionsYesanonymousWho can use the sharing link.
Options: anonymous, organization

All Operations

ParameterTypeRequiredDefaultDescription
Microsoft AccountcredentialNoConnect your Microsoft account via OAuth2.
Max ConcurrencynumberNo10Maximum number of items to process concurrently.

Output Data

Results are merged into the input item’s JSON, so the incoming fields stay available downstream, and binary data on the input item is forwarded.

OperationOutput
file / get, rename, uploadOne item carrying the OneDrive item’s metadata (id, name, size, webUrl, file, parentReference, timestamps …).
file / downloadOne item whose JSON is unchanged; the downloaded file is written to the binary property you named, alongside any binary already on the item.
file / copyOne item carrying location — the monitor URL for the copy, which OneDrive runs asynchronously.
file / deleteOne item carrying success: true.
file / searchOne item per matching file. Folders are filtered out. When nothing matches, one item carrying an empty results array.
file / share, folder / shareOne item carrying the created permission, including a link object with the shareable webUrl.
folder / createOne item carrying the metadata of the folder that was created — for a nested path, the deepest one.
folder / deleteOne item carrying success: true.
folder / getChildrenOne item per child of the folder, files and folders alike. An empty folder produces one item carrying an empty results array.
folder / renameOne item carrying the folder’s updated metadata.
folder / searchOne item per matching folder. Files are filtered out. When nothing matches, one item carrying an empty results array.

A metadata result looks like this:

{
  "id": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K",
  "name": "Q4-2024-Report.xlsx",
  "size": 24576,
  "webUrl": "https://contoso-my.sharepoint.com/personal/…",
  "lastModifiedDateTime": "2024-11-04T10:12:31Z",
  "file": { "mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }
}

Chain operations by expression — for example feed {{ $json.id }} from a search into a download.

Usage Examples

  • Download a file from OneDrive by ID
  • Upload a binary file to a specific OneDrive folder
  • Upload text content as a new file in OneDrive
  • Search OneDrive for files matching a query
  • Create a nested folder structure in OneDrive
  • Get the contents of a OneDrive folder
  • Create a sharing link for a file
  • Copy a file to a different folder
  • Rename a file or folder in OneDrive
  • Delete a file or folder from OneDrive

Example Configuration

Upload a file coming from an upstream node as binary:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "upload",
    "binaryData": true,
    "binaryPropertyName": "data",
    "fileName": "{{ $json.filename }}",
    "parentId": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K"
  }
}

Upload text content as a new file:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "upload",
    "binaryData": false,
    "fileName": "report.txt",
    "fileContent": "{{ $json.body }}",
    "parentId": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K"
  }
}

Download a file into a named binary property:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "download",
    "fileId": "{{ $json.id }}",
    "binaryPropertyName": "downloadedFile"
  }
}

Copy a file into a backup folder under a new name:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "copy",
    "fileId": "{{ $json.originalFileId }}",
    "additionalFields": {
      "name": "backup-{{ $json.originalName }}"
    },
    "parentReference": {
      "id": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD999",
      "path": "/drive/root:/Backups"
    }
  }
}

Create an organization-only edit link:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "share",
    "fileId": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K",
    "type": "edit",
    "scope": "organization"
  }
}

Search for files:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "search",
    "query": "quarterly report 2024"
  }
}

Rename a file:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "rename",
    "itemId": "{{ $json.id }}",
    "newName": "Q4-2024-Report.xlsx"
  }
}

Create a nested folder path in one step:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "folder",
    "operation": "create",
    "name": "/Projects/{{ $json.projectName }}/{{ $json.phase }}",
    "options": {
      "parentFolderId": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD999"
    }
  }
}

List the contents of a folder:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "folder",
    "operation": "getChildren",
    "folderId": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K"
  }
}

Create a public read-only link to a folder:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "folder",
    "operation": "share",
    "folderId": "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K",
    "type": "view",
    "scope": "anonymous"
  }
}

Delete a file:

{
  "type": "microsoft_onedrive",
  "parameters": {
    "resource": "file",
    "operation": "delete",
    "fileId": "{{ $json.id }}"
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Upload, download, copy, delete, rename, search, and share files and folders in Microsoft OneDrive via the Graph API.

  • Uploads are limited to 4 MB. Larger files need to be broken up before they reach this node.
  • Binary File decides where the content comes from. With it on, the node reads the binary property you name; with it off, it uploads the text in File Content and File Name becomes mandatory.
  • Binary property names are case-sensitive. Check the upstream node’s Binary Data panel for the exact name before typing it here.
  • Copy is asynchronous. OneDrive accepts the request and returns a location monitor URL; the copy may not exist yet when the next node runs.
  • Folder create accepts a path. /Reports/2024/Q4 creates each missing level in turn, so you do not need one node per level.
  • Search covers the whole drive and is filtered by resource — file search returns files only, folder search returns folders only.
  • Search and Get Children fan out — each result becomes its own item, so downstream nodes process them individually.
  • Rename uses Item ID, other file operations use File ID. They are the same OneDrive item ID; only the parameter name differs.

Frequently asked questions

Is there a file size limit?

Yes — uploads are limited to 4 MB. Larger files need to be broken up before they reach this node, since it does not perform a chunked upload session.

How do I control what gets uploaded?

The Binary File switch decides. With it on the node reads the binary property you name; with it off it uploads the text in File Content and File Name becomes mandatory.

Why can the node not find my binary property?

Binary property names are case-sensitive. Check the upstream node's Binary Data panel for the exact name rather than assuming it is `data`.

How do I react to new files appearing?

Use the Microsoft OneDrive Trigger, which polls for created or updated files and folders.

Build with the Microsoft OneDrive node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Microsoft OAuth2 credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.