1. Overview
Microsoft OneDrive is a file hosting service operated by Microsoft as part of its web version of Office. It allows users to store files and personal data like Windows settings or BitLocker recovery keys in the cloud, share files, and sync files across Android, Windows Phone, and iOS mobile devices, Windows and macOS computers, and the Xbox 360 and Xbox One consoles.
The Microsoft OneDrive node in GoInsight enables you to automate file and folder management directly within your workflows. You can perform a wide range of operations to orchestrate your cloud storage, including:
- File Management: Upload, download, copy, rename, delete, and retrieve details for specific files.
- Folder Management: Create new folders, list items within a folder, rename, and delete folders.
- Search & Discovery: Search for specific files or folders using keywords.
- Sharing: Create sharing links for files and folders with customizable permissions.
2. Prerequisites
Before using the Microsoft OneDrive node, please ensure you meet the following requirements:
- A valid Microsoft OneDrive account (Personal or Business).
- You must have the necessary permissions to access the files and folders you intend to manage via the API.
3. Credentials
For detailed guidelines on how to acquire and configure credentials, please refer to our official documentation: Credential Configuration Guide.
4. Supported Operations
Summary
This node primarily operates on resources such as Files and Folders within Microsoft OneDrive.
| Resource | Operation | Description | |
|---|---|---|---|
| File | Copy a File | Copies a file from Microsoft OneDrive to a specified destination folder. This is an asynchronous operation — the API returns immediately, then the tool polls for up to 30 seconds waiting for completion. For large files, the copy may still be in progress when the tool returns (check ErrorMessage). Default behavior for name conflicts is automatic rename (e.g., 'Report.pdf' → 'Report 1.pdf'). | |
| File | Delete a File | Deletes a specified file from Microsoft OneDrive. Warning: Deleted files are moved to the OneDrive Recycle Bin and may be permanently removed based on retention policies. | |
| File | Download a File | Retrieves the temporary download link and metadata for a file from Microsoft OneDrive. The download URL typically expires after 1 hour — do not cache it for long-term use; call this action again to get a fresh URL. | |
| File | Get a File | Retrieves detailed metadata and download link for a specific file from Microsoft OneDrive, including file name, size, MIME type, timestamps, and a temporary download URL. | |
| File | Rename a File | Renames a file in Microsoft OneDrive. The file extension should be included in NewName to preserve the file type. | |
| File | Search Files | Searches for files and folders in Microsoft OneDrive by keyword. Searches across file names, content, and metadata. Results may be paginated — check HasMore and NextLink for additional pages. | |
| File | Share a File | Creates a sharing link for a file in Microsoft OneDrive. If a sharing link with the same type and scope already exists, it returns the existing link instead of creating a new one. The link does not expire unless an admin policy enforces expiration. | |
| File | Upload a File | Uploads a file to Microsoft OneDrive. WARNING: If a file with the same name already exists in the target folder, it will be overwritten without warning. File size limit is 4MB (use resumable upload API for larger files). | |
| Folder | Create a Folder | Creates a new folder in Microsoft OneDrive. If a folder with the same name already exists in the target location, OneDrive will automatically rename the new folder (e.g., 'Reports' → 'Reports 1'). | |
| Folder | Delete a Folder | Deletes a specified folder and all its contents from Microsoft OneDrive. The folder is moved to the Recycle Bin (retained for 30 days on personal accounts, 93 days on business accounts). Users can manually restore it during this period. After the retention period, the folder is permanently deleted and cannot be recovered. If the folder is shared, all collaborators will lose access immediately and external sharing links will be invalidated. | |
| Folder | Get Items in Folder | Retrieves items (files and folders) in a specified OneDrive folder. Leave FolderId empty to retrieve root directory items. Results are paginated by OneDrive (~200 items per page). To paginate: check HasMore — if true, pass the returned SkipToken value to the SkipToken input parameter in your next call (keep the same FolderId). Repeat until HasMore is false. | |
| Folder | Rename a Folder | Renames a folder in Microsoft OneDrive. Renaming does not change the folder's unique ID or affect existing shared links. Folder names cannot contain: / \ : * ? " < > \ | |
| Folder | Search Folders | ⚠️ IMPORTANT: Folder results may be INCOMPLETE. OneDrive Search API does NOT support server-side folder filtering — this tool searches ALL items (files + folders) and filters folders locally. If your query matches many files, matching folders may be pushed beyond the scan window and will NOT be returned. Always check HasMore and do NOT assume 'no results' means 'folder does not exist'. Searches for folders in Microsoft OneDrive by keyword. The tool automatically paginates through up to 10 pages of mixed search results, collecting folders across all pages — you do NOT need to handle pagination manually. Use more specific keywords to reduce file noise. For comprehensive folder listing by path (not search), use microsoft_onedrive_get_items_in_folder instead. Use MaxFolders to control how many folders to collect (default 200, max 500). | |
| Folder | Share a Folder | Creates a sharing link for a folder in Microsoft OneDrive. If a sharing link with the same type and scope already exists, it returns the existing link instead of creating a new one. The link does not expire unless an admin policy enforces expiration. |
Operation Details
Copy a File
Copies a file from Microsoft OneDrive to a specified destination folder. This is an asynchronous operation — the API returns immediately, then the tool polls for up to 30 seconds waiting for completion. For large files, the copy may still be in progress when the tool returns (check ErrorMessage). Default behavior for name conflicts is automatic rename (e.g., 'Report.pdf' → 'Report 1.pdf').
Input Parameters:
- FileId: The unique identifier of the source file to copy. Obtain this ID by calling the microsoft_onedrive_search_files or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
- DestinationFolderId: The unique identifier of the destination folder. Obtain this ID by calling the microsoft_onedrive_search_folders or microsoft_onedrive_get_items_in_folder tool. Use 'root' for the root folder. Example: '01BYE5RZ5MYLM2SMX75ZBIPQZIHT6OAYPB'.
Options:
- NewName: Optional new name for the copied file (including extension, e.g., 'Annual_Report_2024_Copy.pdf'). If empty, the original file name is used.
- ConflictBehavior: Behavior when a file with the same name exists in the destination folder. Options: 'rename' (automatically rename the new file, e.g., 'Report.pdf' → 'Report 1.pdf'), 'replace' (overwrite the existing file), 'fail' (return an error). Default: 'rename'.
Output:
- FileId (string): The unique identifier of the newly copied file (not the source file). Empty string if the copy failed or is still in progress.
- FileName (string): The name of the newly copied file. Empty string if the copy failed or is still in progress.
- WebUrl (string): The browser URL to view or open the newly copied file online in OneDrive. Empty string if the copy failed or is still in progress.
- ParentFolderId (string): The unique identifier of the destination folder containing the newly copied file. Empty string if the copy failed or is still in progress.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 202 for accepted, 401 for auth failure). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Delete a File
Deletes a specified file from Microsoft OneDrive. Warning: Deleted files are moved to the OneDrive Recycle Bin and may be permanently removed based on retention policies.
Input Parameters:
- FileId: The unique identifier of the file to delete. Obtain this ID by calling the microsoft_onedrive_search_files or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Output:
- Deleted (bool): Whether the file was successfully deleted. true = file deleted, false = deletion failed (check ErrorMessage for details).
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 204 for deleted, 404 for not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Download a File
Retrieves the temporary download link and metadata for a file from Microsoft OneDrive. The download URL typically expires after 1 hour — do not cache it for long-term use; call this action again to get a fresh URL.
Input Parameters:
- FileId: The unique identifier of the file to download. Obtain this ID by calling the microsoft_onedrive_search_files or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Output:
- DownloadUrl (string): The temporary download URL for the file. This URL typically expires after 1 hour — do not cache or store it for long-term use. Empty string if retrieval failed.
- FileName (string): The name of the file including extension (e.g., 'Project_Report_2024.pdf'). Empty string if retrieval failed.
- FileSize (number): The size of the file in bytes (e.g., 2457600 = approximately 2.4 MB). 0 if retrieval failed.
- MimeType (string): The file format identifier (MIME type), tells you what kind of file it is. Common values: 'application/pdf' (PDF document), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' (Word .docx), 'image/jpeg' (JPEG image), 'text/plain' (plain text file). Empty string if retrieval failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 200 for success, 404 for not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Get a File
Retrieves detailed metadata and download link for a specific file from Microsoft OneDrive, including file name, size, MIME type, timestamps, and a temporary download URL.
Input Parameters:
- FileId: The unique identifier of the file to retrieve. Obtain this ID by calling the microsoft_onedrive_search_files or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Output:
- FileId (string): The unique identifier of the file. Empty string if retrieval failed.
- FileName (string): The name of the file including extension (e.g., 'Q4_Report.pdf'). Empty string if retrieval failed.
- FileSize (number): The size of the file in bytes (e.g., 1048576 = approximately 1 MB). 0 if retrieval failed.
- WebUrl (string): The URL to view/edit the file in the browser. Empty string if retrieval failed.
- DownloadUrl (string): The temporary download URL for the file. This URL typically expires after 1 hour — do not cache or store it for long-term use. Empty string if retrieval failed.
- MimeType (string): The MIME type of the file indicating its format. Common values: 'application/pdf' (PDF), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' (Word .docx), 'image/jpeg' (JPEG image), 'text/plain' (plain text). Empty string if retrieval failed.
- CreatedDateTime (string): The creation timestamp of the file in ISO 8601 format (e.g., '2024-01-15T10:30:00Z'). Empty string if retrieval failed.
- LastModifiedDateTime (string): The last modification timestamp of the file in ISO 8601 format (e.g., '2024-01-20T14:45:00Z'). Empty string if retrieval failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 200 for success, 404 for not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Rename a File
Renames a file in Microsoft OneDrive. The file extension should be included in NewName to preserve the file type.
Input Parameters:
- FileId: The unique identifier of the file to rename. Obtain this ID by calling the microsoft_onedrive_search_files or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
- NewName: The new name for the file. Must include the file extension (e.g., .xlsx, .docx, .pdf) to preserve the file type. Omitting the extension may make the file unopenable. Example: 'Q4_Sales_Report_Final.xlsx'.
Output:
- FileId (string): The unique identifier of the renamed file. Empty string if rename failed.
- FileName (string): The new name of the file after renaming, including extension. Empty string if rename failed.
- WebUrl (string): The URL to view/edit the file in the browser. Empty string if rename failed.
- LastModifiedDateTime (string): The last modification timestamp of the file in ISO 8601 format (e.g., '2024-01-15T14:30:00Z'). Empty string if rename failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 200 for success, 404 for not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Search Files
Searches for files and folders in Microsoft OneDrive by keyword. Searches across file names, content, and metadata. Results may be paginated — check HasMore and NextLink for additional pages.
Input Parameters:
- Query: Search keyword to find files in OneDrive. Searches across file names, content, and metadata. Supports simple keywords (e.g., 'budget'), multiple words (e.g., 'budget report 2024'), and phrase search. Example: 'budget report'.
Output:
- Files (object-array): An array of file/folder objects matching the search query. Each object contains: id (string, unique identifier), name (string, file name with extension), size (number, bytes), webUrl (string, browser URL), createdDateTime (string, ISO 8601), lastModifiedDateTime (string, ISO 8601), createdBy.user.displayName (string), file.mimeType (string, only for files). Empty array if search failed or no results.
- Count (number): The number of items returned in this page of results. May be less than total matches if results are paginated.
- NextLink (string): The URL to fetch the next page of search results. Empty string if there are no more results. Pass this URL directly to retrieve additional pages.
- HasMore (boolean): Whether there are more search results beyond this page. true if NextLink is present, false otherwise.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 200 for success, 401 for unauthorized). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Share a File
Creates a sharing link for a file in Microsoft OneDrive. If a sharing link with the same type and scope already exists, it returns the existing link instead of creating a new one. The link does not expire unless an admin policy enforces expiration.
Input Parameters:
- FileId: The unique identifier of the file to share. Obtain this ID by calling the microsoft_onedrive_search_files, microsoft_onedrive_get_items_in_folder, or microsoft_onedrive_get_a_file tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Options:
- ShareType: Share permission type. Must be one of: 'view' (read-only preview), 'edit' (can modify the file), 'embed' (embeddable in a webpage). Default: 'view'.
- Scope: Who can access the sharing link. Must be one of: 'anonymous' (anyone with the link, no sign-in required), 'organization' (only people in the same organization, sign-in required). Default: 'anonymous'.
Output:
- ShareId (string): The permission ID of the sharing link (e.g., 'u!aHR0cHM6Ly8xZHJ2Lm1z...'). Can be used to revoke the link later. Empty string if creation failed.
- ShareUrl (string): The sharing link URL that can be sent to recipients (e.g., 'https://1drv.ms/u/s!AquxxxxxxxxYYYY'). This is a short URL. Empty string if creation failed.
- ShareType (string): The actual sharing type applied: 'view', 'edit', or 'embed'. Empty string if creation failed.
- Scope (string): The actual sharing scope applied: 'anonymous' or 'organization'. Empty string if creation failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (201=new link created, 200=existing link returned). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Upload a File
Uploads a file to Microsoft OneDrive. WARNING: If a file with the same name already exists in the target folder, it will be overwritten without warning. File size limit is 4MB (use resumable upload API for larger files).
Input Parameters:
- FileName: The name of the file to upload, must include the file extension. Example: 'quarterly_report.pdf'. File names cannot contain: / \ : * ? " < > |
- FileContent: The file content as a pure Base64 encoded string (do NOT include the 'data:...' prefix). Supports all file types (PDF, images, Word, Excel, etc.). Max size: 4MB after decoding. Example: 'JVBERi0xLjQKJeLjz9MK...' (PDF file header).
Options:
- ParentFolderId: Parent folder ID where the file will be uploaded (optional). If empty, uploads to root directory. Obtain this ID by calling the microsoft_onedrive_get_items_in_folder or microsoft_onedrive_search_folders tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Output:
- FileId (string): The unique identifier of the uploaded file. Empty string if upload failed.
- FileName (string): The name of the uploaded file (with extension). Empty string if upload failed.
- FileSize (number): The size of the uploaded file in bytes. 0 if upload failed.
- WebUrl (string): The URL to access the file in the browser. Empty string if upload failed.
- DownloadUrl (string): A temporary pre-authenticated download URL for the file. This URL expires after a short period. Empty string if upload failed.
- CreatedDateTime (string): The creation timestamp of the file in ISO 8601 format (e.g., '2024-01-15T10:30:00Z'). Empty string if upload failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (201=new file created, 200=existing file overwritten). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Create a Folder
Creates a new folder in Microsoft OneDrive. If a folder with the same name already exists in the target location, OneDrive will automatically rename the new folder (e.g., 'Reports' → 'Reports 1').
Input Parameters:
- FolderName: The name of the folder to create. Must not contain the following characters: / \ : * ? " < > |. Maximum length: 255 characters. Example: 'Project Documents' or 'Q1 2024 Reports'.
Options:
- ParentFolderId: The unique identifier of the parent folder (optional). If empty, the folder will be created in the root directory. Obtain folder IDs by calling the microsoft_onedrive_search_folders or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Output:
- FolderId (string): The unique identifier of the newly created folder. Empty string if creation failed.
- FolderName (string): The actual name of the created folder. May differ from the requested name if auto-renamed due to conflict (e.g., 'Reports 1'). Empty string if creation failed.
- WebUrl (string): The browser URL to view or open the newly created folder online in OneDrive. Empty string if creation failed.
- ParentFolderId (string): The unique identifier of the parent folder containing the newly created folder. Empty string if creation failed.
- CreatedDateTime (string): The creation timestamp of the folder in ISO 8601 format (UTC timezone). Example: '2024-01-15T10:30:00Z'. Empty string if creation failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 201 for created, 400 for bad request). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Delete a Folder
Deletes a specified folder and all its contents from Microsoft OneDrive. The folder is moved to the Recycle Bin (retained for 30 days on personal accounts, 93 days on business accounts). Users can manually restore it during this period. After the retention period, the folder is permanently deleted and cannot be recovered. If the folder is shared, all collaborators will lose access immediately and external sharing links will be invalidated.
Input Parameters:
- FolderId: The folder ID (a unique alphanumeric string like '01BYE5RZ...') of the folder to delete. Obtain this ID by calling the microsoft_onedrive_search_folders or microsoft_onedrive_get_items_in_folder tool. Example: '01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ'. Note: Deleting a shared folder will revoke access for all collaborators and invalidate any external sharing links.
Output:
- Deleted (bool): Whether the folder was successfully deleted. true = folder and all its contents moved to Recycle Bin, false = deletion failed (check ErrorMessage for details). Also false if StatusCode is 500 (network/system error).
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 204 for deleted, 404 for not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Get Items in Folder
Retrieves items (files and folders) in a specified OneDrive folder. Leave FolderId empty to retrieve root directory items. Results are paginated by OneDrive (~200 items per page). To paginate: check HasMore — if true, pass the returned SkipToken value to the SkipToken input parameter in your next call (keep the same FolderId). Repeat until HasMore is false.
Options:
- FolderId: The unique identifier of the folder to list (optional). Leave empty (or pass empty string) to retrieve root directory items. Do NOT pass the literal string 'root'. Obtain folder IDs from the microsoft_onedrive_search_folders tool or from the 'id' field of a previous Get Items in Folder response. Example: '01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ'.
- SkipToken: Pagination token for retrieving the next page of results. Leave empty for the first page. Obtain this value from the SkipToken field of a previous response. Example: 'Paged=TRUE&p_ID=123'.
Output:
- Items (object-array): Array of item objects (files and folders) in the current page. Each item contains: id (string, unique identifier), name (string, file/folder name), size (number, bytes — 0 for folders), createdDateTime (string, ISO 8601), lastModifiedDateTime (string, ISO 8601), webUrl (string, browser URL). Files also have: file.mimeType (string, e.g. 'application/pdf'). Folders also have: folder.childCount (number, items inside). Empty array if retrieval failed.
- Count (number): Number of items returned in the current page (not the total count). Check HasMore to determine if more pages exist.
- HasMore (bool): Whether more items exist beyond the current page. true = pass SkipToken to the next call to get more; false = all items have been returned.
- SkipToken (string): Pagination token for the next page. Pass this value to the SkipToken input parameter in your next call (with the same FolderId). Empty string if this is the last page.
- NextLink (string): Full URL for the next page (advanced use only — prefer SkipToken for pagination). Empty string if this is the last page.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 200 for success, 404 for folder not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Rename a Folder
Renames a folder in Microsoft OneDrive. Renaming does not change the folder's unique ID or affect existing shared links. Folder names cannot contain: / \ : * ? " < > |
Input Parameters:
- FolderId: The unique identifier of the folder to rename. Obtain this ID by calling the microsoft_onedrive_get_items_in_folder or microsoft_onedrive_search_files tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
- NewName: The new name for the folder. Supports spaces and most characters, but cannot contain: / \ : * ? " < > |. Maximum length: 255 characters. Example: 'Project Reports 2024'.
Output:
- FolderId (string): The unique identifier of the renamed folder. Empty string if rename failed.
- FolderName (string): The new name of the folder after renaming. Empty string if rename failed.
- WebUrl (string): The URL to access the folder in the browser. Empty string if rename failed.
- LastModifiedDateTime (string): The last modification timestamp of the folder in ISO 8601 format (e.g., '2024-01-15T10:30:00Z'). Empty string if rename failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (e.g., 200 for success, 404 for not found). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Search Folders
⚠️ IMPORTANT: Folder results may be INCOMPLETE. OneDrive Search API does NOT support server-side folder filtering — this tool searches ALL items (files + folders) and filters folders locally. If your query matches many files, matching folders may be pushed beyond the scan window and will NOT be returned. Always check HasMore and do NOT assume 'no results' means 'folder does not exist'. Searches for folders in Microsoft OneDrive by keyword. The tool automatically paginates through up to 10 pages of mixed search results, collecting folders across all pages — you do NOT need to handle pagination manually. Use more specific keywords to reduce file noise. For comprehensive folder listing by path (not search), use microsoft_onedrive_get_items_in_folder instead. Use MaxFolders to control how many folders to collect (default 200, max 500).
Input Parameters:
- Query: Search keyword to find folders in OneDrive. Searches across folder names, metadata, and content. Supports simple keywords (e.g., 'project'), multiple words (e.g., 'quarterly report 2024'), and phrase search. Case-insensitive. Example: 'project report'.
Options:
- MaxFolders: Maximum number of folders to return. Default 200, range 1-500. The tool auto-paginates through search results until this many folders are collected or all results are exhausted (max 10 pages). Values outside range are auto-corrected.
Output:
- Folders (object-array): An array of folder objects matching the search query, aggregated across multiple search result pages. ⚠️ Results may be INCOMPLETE due to API limitation — if the query matches many files, some matching folders may not appear. Do NOT treat empty results as proof that no matching folder exists. Each object contains: id (string, unique identifier), name (string, folder name), webUrl (string, browser URL), folder.childCount (number, items in folder), createdDateTime (string, ISO 8601), lastModifiedDateTime (string, ISO 8601), parentReference.path (string, parent path). Empty array if search failed or no folders found.
- Count (number): The total number of folders returned (aggregated across all scanned pages).
- HasMore (boolean): Whether there may be more matching folders beyond the returned results. ⚠️ ALWAYS check this field. true means results are definitely incomplete — either the MaxFolders limit was reached or there are unscanned pages remaining. Even when false, results may still be incomplete due to the API limitation (folders hidden among file-heavy pages).
- TotalPagesScanned (number): The number of API result pages scanned during this search. Use for debugging and performance monitoring. Max 10 pages per call.
- OriginalStatusCode (number): The HTTP status code from the last OneDrive API request (e.g., 200 for success, 401 for unauthorized). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
Share a Folder
Creates a sharing link for a folder in Microsoft OneDrive. If a sharing link with the same type and scope already exists, it returns the existing link instead of creating a new one. The link does not expire unless an admin policy enforces expiration.
Input Parameters:
- FolderId: The unique identifier of the folder to share. Obtain this ID by calling the microsoft_onedrive_get_items_in_folder or microsoft_onedrive_search_folders tool. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
Options:
- ShareType: Share permission type. Must be one of: 'view' (read-only, recipients can view and download), 'edit' (full access, recipients can view, upload, and modify files), 'embed' (embeddable iframe link for embedding in web pages). Default: 'view'.
- Scope: Who can access the sharing link. Must be one of: 'anonymous' (anyone with the link, no sign-in required), 'organization' (only people in the same organization, sign-in required). Default: 'anonymous'.
Output:
- ShareId (string): The permission ID of the sharing link (e.g., 'u!aHR0cHM6Ly8xZHJ2Lm1z...'). Can be used to revoke the link later. Empty string if creation failed.
- ShareUrl (string): The sharing link URL that can be sent to recipients (e.g., 'https://1drv.ms/f/s!AquxxxxxxxxYYYY'). This is a short URL. Empty string if creation failed.
- ShareType (string): The actual sharing type applied: 'view', 'edit', or 'embed'. Empty string if creation failed.
- Scope (string): The actual sharing scope applied: 'anonymous' or 'organization'. Empty string if creation failed.
- OriginalStatusCode (number): The original HTTP status code returned by the OneDrive API (201=new link created, 200=existing link returned). Default 0 means the request did not reach upstream. Use for debugging.
- StatusCode (number): Operation status code: 200=Success (check ErrorMessage for business errors), -1=Parameter validation error, 500=System error (network timeout/connection failure).
- ErrorMessage (string): Detailed error message if any error occurred. Empty string if the operation succeeded.
5. Example Usage
This section guides you through creating a simple workflow to create a new folder in your Microsoft OneDrive. This is a fundamental operation that helps organize your files automatically.
Scenario: You want to create a new folder named "Q1 Reports" in the root directory of your OneDrive to store upcoming quarterly reports.
Workflow Overview: Start -> Microsoft Onedrive -> Answer
Step-by-Step Guide:
- Add the Tool Node:
- In your workflow canvas, click the "+" button to add a new node.
- Select the "Tools" tab.
- Search for and select Microsoft Onedrive.
- From the list of supported operations, choose Create a Folder. This will add the node to your canvas.
- Configure the Node:
- Click the Create a Folder node to open its configuration panel.
- Credentials: At the top of the panel, select your configured Microsoft Onedrive credential.
- Input Parameters:
- FolderName: Enter Q1 Reports. This is the name of the folder you wish to create.
- ParentFolderId: Leave this field empty. By default, leaving it empty will create the folder in your OneDrive's root directory.
- Run and Verify:
- Ensure there are no error messages on the node.
- Click the "Run" button in the top right corner of the canvas.
- Once the execution is complete, click the "Logs" icon to view the output. You should see a FolderId and a WebUrl indicating the folder was successfully created.
Result: After completing these steps, a new folder named "Q1 Reports" will appear in your Microsoft OneDrive root directory.
6. FAQs
Q: What happens if I try to upload a file larger than 4MB?
A: The Upload a File action in this tool is designed for files up to 4MB.
- Small Files: Files under 4MB are uploaded directly.
- Large Files: For files larger than 4MB, the upload may fail or be incomplete. You should use a resumable upload session, which is currently not supported by this specific action.
Q: Why are my folder search results incomplete?
A: The Search Folders action has some limitations due to the OneDrive API.
- API Limitation: The API searches all items (files and folders) and filters for folders locally.
- Pagination: If your search query matches a large number of files, the matching folders might be pushed to later pages that aren't scanned, resulting in them not being returned.
- Recommendation: Use specific keywords to reduce the number of file matches, or use Get Items in Folder if you know the parent directory.
Q: Can I recover a deleted folder?
A: Yes, but with conditions.
- Recycle Bin: Deleted folders are moved to the OneDrive Recycle Bin.
- Retention: They are retained for 30 days (personal accounts) or 93 days (business accounts).
- Permanent Deletion: After this period, or if you empty the Recycle Bin, the folder is permanently deleted and cannot be recovered.
Leave a Reply.