> ## Documentation Index
> Fetch the complete documentation index at: https://agents.nanonets.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# OneDrive Upload

> Tool that uploads a file from a URL into the connected user's personal OneDrive, inserting a new file or replacing an existing one.

This document covers `export_to_onedrive` (display name **"OneDrive Upload"**), the tool that uploads a file from a URL into the connected user's personal OneDrive, inserting a new file or replacing an existing one. For SharePoint sites and document libraries, see the sibling tool `export_to_sharepoint`.

## Choosing between OneDrive and SharePoint upload

The two upload tools are bound to **different connectors** (separate Azure AD apps), and the platform's variable injection resolves exactly one connector per tool — so the choice is determined by where the file must go and which connector the workspace has:

|                    | `export_to_onedrive`                                             | `export_to_sharepoint`                                                                       |
| ------------------ | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| Connector (token)  | **OneDrive**                                                     | **SharePoint**                                                                               |
| Destination        | Connected account's personal OneDrive (`/me/drive`)              | SharePoint site document library, or the SharePoint connector account's OneDrive as fallback |
| Same-name conflict | `conflict_behavior` honored at any file size (`replace` default) | Replaces ≤4 MB; **renames** above 4 MB (chunked path)                                        |

If a workspace has only the OneDrive connector connected, `export_to_sharepoint` cannot see it (and vice versa).

## Authentication

Uses the **OneDrive** connector. The access token is injected by the platform — the tool never receives raw credentials as a per-run input.

The tool registers only when OneDrive OAuth is configured. Outbound Microsoft Graph calls are audited.

## Enablement

Off by default — enable it in the agent's Tools panel. This avoids offering two near-identical upload tools to every agent by default (see the disambiguation table above).

## Inputs

Required:

* `file_url`: URL of the file to upload — an S3 storage URL, a presigned URL, a `generate_file`/`python_code` output URL, or a signed download URL from a web automation result.
* `file_name`: Destination filename including extension (e.g. `report.csv`).

Optional:

* `folder_path`: Slash-separated folder path (e.g. `Data/CSV`). Missing folders are created automatically. Omitted = OneDrive root.
* `conflict_behavior`: What to do when a same-named file already exists in the folder:
  * `replace` (default): overwrite in place — the existing drive item keeps its ID and version history, no duplicate is created.
  * `rename`: keep both; the new file is saved as `name 1.ext`.
  * `fail`: return an error and leave the existing file untouched.
* `mime_type`: MIME type; auto-detected from the `file_name` extension when omitted.

## Upload mechanics

* Files **≤ 4 MB** upload with a single `PUT …:/content` request.
* Larger files use a resumable Graph upload session with 10 MB chunks.
* `conflict_behavior` is passed through on **both** paths (query parameter on the simple PUT, session body on the chunked path), so replace semantics hold at any file size.

## Output

Structured result with `file_id`, `file_name`, `file_url` (OneDrive web URL), `mime_type`, `file_size`, `drive_id`, `folder_path`, `conflict_behavior`, and `completed_at`, plus a markdown summary linking to the uploaded file.

## Errors

* Missing/empty `file_url` or `file_name`, or an unknown `conflict_behavior` value, fail validation before any network call.
* A `conflict_behavior: "fail"` collision surfaces Microsoft Graph's `nameAlreadyExists` error.
* Download failures of `file_url` (expired signed URL, wrong scheme) are returned as structured tool errors so the agent can retry or re-fetch the source.
