Files
Files is a component that lets you work with files stored in Microsoft OneDrive.
You can list files in a folder, download a file, upload new files, update an existing file, or delete a file.
All actions are performed through the OneDrive API, so you only need to set up a OneDrive credential once and then use the component in any workflow.
How it Works
When you add the Files component to a workflow, it connects to Microsoft OneDrive using the credential you selected.
The component sends HTTP requests to the OneDrive Graph API to perform the chosen operation.
If you enable Mapping Mode, the component can process many records at once – for example, you can list all files in a folder and then upload a batch of new files in a single run.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Get Folder Files: Retrieve a list of files that are inside a specified folder.
- Get File: Download a single file by its ID or URL.
- Upload Files: Add one or more new files to a folder.
- Update File: Replace the content of an existing file or rename it.
- Delete File: Remove a file from OneDrive.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Credential
Before you can use the component, you must create a Microsoft One Drive credential in the Credentials section of Nappai.
After creating it, select that credential in the “Credential” field of this component.
The credential requires the following information:
- Client ID
- Client Secret
- Tenant ID
- Microsoft onedrive access
Mapping Mode
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
File to upload: Files to upload (as file ID, URL or bytes).
- Visible in: Upload Files
-
Select file: File selected.
- Visible in: Get File, Update File, Delete File
-
Select folder: [formatted string].
- Visible in: Get Folder Files, Upload Files
-
New Content: New content for the file update.
- Visible in: Update File
-
Operation: Choose which action to perform.
- Visible in: Get Folder Files, Get File, Upload Files, Update File, Delete File
-
Download File Content: Download content of the file (optional).
- Visible in: Get Folder Files, Get File
-
File Path Or Url: File Id or Url.
- Visible in: Get File, Update File, Delete File
-
File Id or URL: Files to upload (as file ID, URL or bytes).
- Visible in: Upload Files
-
Selection Mode: (first occurrence)
- Visible in: Get File, Update File, Delete File
-
File Type: Type of files to search for.
- Visible in: Get Folder Files
-
Folder Path Or Url: Folder Path or Url.
- Visible in: Get Folder Files, Upload Files
-
Selection Mode: (second occurrence)
- Visible in: Get Folder Files, Upload Files
-
Mapping Mode: Enable mapping mode to process multiple data records in batch.
- Visible in: Get Folder Files, Get File, Upload Files, Update File, Delete File
-
Max Count: Maximum number of files to retrieve.
- Visible in: Get Folder Files
-
New Name: New name for the file (optional for update).
- Visible in: Update File
-
Load File Content: Load the data text content of the file.
- Visible in: Get Folder Files, Get File
-
Tool Name: The name of the tool that will be used when this component is connected as a tool.
- Visible in: Get Folder Files, Get File, Upload Files, Update File, Delete File
-
Tool Description: A detailed description of what this tool does.
- Visible in: Get Folder Files, Get File, Upload Files, Update File, Delete File
-
Tools arguments metadata: Defines the arguments metadata for the tools.
- Visible in: Get Folder Files, Get File, Upload Files, Update File, Delete File
Outputs
- Data: The raw data returned from OneDrive (e.g., file metadata, file content).
- Tool: A tool representation that can be used by an AI agent to call this component.
Usage Example
Scenario 1 – List files in a folder
- Drag the Files component into your workflow.
- Set Operation to “Get Folder Files”.
- Enter the folder path or URL in Folder Path Or Url.
- (Optional) Set Max Count to limit how many files are returned.
- Connect the Data output to the next component that will process the list.
Scenario 2 – Upload a new file
- Drag the Files component into your workflow.
- Set Operation to “Upload Files”.
- Provide the folder path in Folder Path Or Url.
- Add the file you want to upload in File Id or URL (you can use a file picker or a previous component that supplies the file).
- Connect the Data output to a component that will confirm the upload or use the file ID later.
Related Components
- OneDriveFolderComponent – Manage folders (create, delete, rename).
- OneDriveFileComponent – This component (Files).
Tips and Best Practices
- Use Mapping Mode when you need to process many files at once, such as uploading a batch of documents.
- Keep the Max Count low if you only need a few files; this reduces API calls and speeds up the workflow.
- Store the file content in a variable if you plan to use it in later steps.
- When updating a file, provide the new content in New Content and optionally set New Name if you want to rename it.
Security Considerations
- Store your Microsoft One Drive credential in the Credentials section and never expose the Client Secret in the workflow.
- Use the Credential field to reference the stored credential; this keeps sensitive data out of the component’s visible inputs.
- If you share a workflow, make sure the recipient also has access to the same credential or create a new one for them.