Workflows
Blocks
Integrations
Microsoft OneDrive

Microsoft OneDrive Action Block

What it does: Manage files and folders in Microsoft OneDrive directly from your workflow, including uploading, downloading, sharing, and organizing content.

☁️

In simple terms: Automate file management in OneDrive -- upload documents, organize folders, share files, and search for content as part of your workflow.

When to Use This

Use the OneDrive action when you need to:

  • ✅ Upload generated reports or documents to OneDrive automatically
  • ✅ Download files from OneDrive for processing in your workflow
  • ✅ Share files or folders with team members or external users
  • ✅ Organize files into folders based on workflow logic
  • ✅ Search for specific files across your OneDrive storage

Example: When a customer submits a signed contract, upload it to a specific OneDrive folder and share it with the legal team.

Features

  • OAuth2 Authentication: Secure Microsoft identity platform connection
  • File Operations: Upload, download, copy, delete, search, and share files
  • Folder Management: Create, delete, list, and share folders
  • File Metadata: Retrieve detailed file information including size, type, and modification dates
  • Variable Support: Use workflow variables for dynamic file paths and names
  • Search: Find files across your OneDrive using search queries

Setup

1. Connect Your Microsoft Account

  1. Click Connect Microsoft Account in the block settings
  2. Sign in with your Microsoft 365 or personal Microsoft account
  3. Grant the requested OneDrive permissions (Files.ReadWrite.All)
  4. Your account will be linked securely via OAuth2
⚠️

Your Indite instance must have MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET environment variables configured for OAuth2 to work. Contact your administrator if the connection fails.

2. Configure Settings

  1. Select the desired Action from the dropdown (e.g., Upload File, Search Files)
  2. Fill in the required fields for that action
  3. Optionally map response values to workflow variables

Supported Actions

ActionDescription
Upload FileUpload a file to a specified OneDrive path
Download FileDownload a file by its path or ID
Delete FilePermanently delete a file from OneDrive
Copy FileCopy a file to another location in OneDrive
Search FilesSearch for files by name or content
Share FileGenerate a sharing link for a file
Get File InfoRetrieve metadata (size, type, modified date) for a file
Create FolderCreate a new folder at a specified path
Delete FolderDelete a folder and its contents
List FolderList all items inside a folder
Share FolderGenerate a sharing link for a folder

Using Variables

You can use workflow variables in any field:

Upload Path:

/Reports/{{date.year}}/{{date.month}}/report-{{order.id}}.pdf

Search Query:

{{customer.name}} contract

Share Recipients:

{{team.managerEmail}}

Response Mapping

Map results from OneDrive actions to workflow variables:

Available Values (varies by action):

  • File ID: Unique OneDrive item identifier
  • File Name: Name of the file
  • File Size: Size in bytes
  • Web URL: Browser-accessible link to the file
  • Download URL: Direct download link
  • Created Date: When the file was created
  • Modified Date: When the file was last modified
  • Share Link: Generated sharing URL (for Share actions)
  • Folder Children: List of items in a folder (for List Folder)

Example Mapping:

File ID → {{onedrive.fileId}}
Web URL → {{onedrive.webUrl}}
Share Link → {{onedrive.shareLink}}

Common Use Cases

1. Automated Report Archival

Trigger: Schedule (Every Friday 5 PM) OneDrive Action: Upload File

File: {{report.pdfContent}}
Path: /Weekly Reports/{{date.year}}/week-{{date.weekNumber}}.pdf

2. Contract Document Sharing

Trigger: Contract signed webhook OneDrive Action: Upload File, then Share File

Upload Path: /Contracts/{{client.name}}/{{contract.id}}.pdf
Share With: {{client.email}}
Permission: View Only

3. File Search and Processing

Trigger: Manual or scheduled OneDrive Action: Search Files

Query: invoice {{date.lastMonth}}

Then loop through results to process each matching file.

4. Team Folder Organization

Trigger: New project created OneDrive Action: Create Folder

Path: /Projects/{{project.name}}

Then create subfolders for Documents, Assets, and Deliverables.

Best Practices

File Organization

  • ✅ Use consistent naming conventions with variables (e.g., {{date.iso}}-{{type}}-{{id}})
  • ✅ Organize files in a logical folder hierarchy
  • ✅ Clean up temporary files after processing

Performance

  • ✅ Avoid uploading very large files (>250 MB) in time-sensitive workflows
  • ✅ Use Search Files instead of listing entire directories when looking for specific items
  • ✅ Cache file IDs when you need to reference the same file multiple times

Security

  • ✅ Use the minimum required sharing permissions (View vs. Edit)
  • ✅ Set expiration dates on sharing links when possible
  • ✅ Regularly audit shared files and revoke unnecessary access
  • ✅ Never store sensitive credentials in file names or paths

Troubleshooting

File Upload Fails

Check:

  • Microsoft account is properly connected and token has not expired
  • The destination folder exists (create it first if needed)
  • File size is within OneDrive limits
  • You have sufficient OneDrive storage space

Permission Denied

Solutions:

  • Reconnect your Microsoft account to refresh permissions
  • Ensure the account has access to the target OneDrive or SharePoint location
  • Verify that the OAuth scope includes Files.ReadWrite.All

Search Returns No Results

Check:

  • The search query is not too specific -- try broader terms
  • The file was recently uploaded -- OneDrive indexing may take a few minutes
  • You are searching in the correct OneDrive account

Limitations

  • File Size: OneDrive supports files up to 250 GB, but workflow uploads are limited by timeout settings
  • API Rate Limits: Microsoft Graph API throttling applies (approximately 10,000 requests per 10 minutes)
  • Search Indexing: Newly uploaded files may not appear in search results immediately
  • Shared Drives: Access to other users' OneDrive requires appropriate admin permissions
💡

Tip: For large file operations, consider breaking them into smaller batches and using the workflow engine's retry mechanism for reliability.

Related Blocks

  • SharePoint: Manage files in SharePoint document libraries
  • Google Drive: Alternative cloud storage integration
  • Excel 365: Work with Excel files stored in OneDrive
  • Condition: Add logic before file operations
  • Set Variable: Prepare file paths and names dynamically
Indite Documentation v1.6.0
PrivacyTermsSupport