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

# OneDrive

> Index documents from a user's OneDrive for Business into a Vector using a Microsoft Entra ID app registration.

<Badge color="green" shape="pill" icon="sparkles">New</Badge> <Badge color="blue" shape="pill" icon="vector-square">Vectors only</Badge>

# Overview

OneDrive for Business is Microsoft's personal cloud storage for Microsoft 365 users. Datazone connects to **one user's OneDrive** through Microsoft Graph with app-only (client credentials) access, and indexes the documents in it into a [Vector](/reference/development/vectors).

<Note>
  OneDrive sources hold documents, not tables. They are used by **Vectors** only — they have no extracts and no schema to infer.
</Note>

## Prerequisites

Create an app registration in Microsoft Entra ID and give it read access to files. See [How to get the credentials](#how-to-get-the-credentials) below.

## Connection Parameters

Set on the source when you create it. Names match the API and CLI payload.

<ParamField path="name" type="string" required>
  **Name** — a unique identifier for your OneDrive source.
</ParamField>

<ParamField path="user_principal_name" type="string" required>
  **User** — the sign-in email (user principal name) of the person whose OneDrive is indexed, for example `ayse@contoso.com`.
</ParamField>

<ParamField path="tenant_id" type="string" required>
  **Tenant ID** — the Directory (tenant) ID of the app registration.
</ParamField>

<ParamField path="client_id" type="string" required>
  **Client ID** — the Application (client) ID of the app registration.
</ParamField>

<ParamField path="client_secret" type="string" required>
  **Client Secret** — the client secret **value** of the app registration. Stored encrypted.
</ParamField>

## How to get the credentials

<Steps>
  <Step title="Register an app">
    In the [Azure portal](https://portal.azure.com), open **Microsoft Entra ID → App registrations → New registration**. Give it a name such as `datazone-onedrive` and leave the defaults (single tenant).
  </Step>

  <Step title="Copy the Tenant ID and Client ID">
    On the app's **Overview** page, copy **Directory (tenant) ID** and **Application (client) ID**.
  </Step>

  <Step title="Create a client secret">
    Go to **Certificates & secrets → New client secret**, choose an expiry, and copy the **Value** immediately. It is shown only once. Use the *Value*, not the *Secret ID*.
  </Step>

  <Step title="Grant read permission">
    Go to **API permissions → Add a permission → Microsoft Graph → Application permissions** and add `Files.Read.All` (or `Sites.Read.All`).
  </Step>

  <Step title="Grant admin consent">
    Click **Grant admin consent for \<your tenant>**. This needs a Global Administrator or Privileged Role Administrator. Without it, Datazone gets a `403` from Microsoft Graph.
  </Step>

  <Step title="Note the user">
    Use the user's sign-in email as `user_principal_name`. The user needs a OneDrive for Business license, and must have signed in to OneDrive at least once so the drive exists.
  </Step>
</Steps>

<Warning>
  `Files.Read.All` as an application permission lets the app read files of **every user** in the tenant, not just the one you configure. Use a dedicated app registration for Datazone and protect its client secret.
</Warning>

## Using the source in a Vector

When you create a [Vector](/reference/development/vectors), choose a connected source as the data source, then pick a path. The vector stores them as `source` and `source_path`, and both must be set together.

The path is a folder or file path from the root of the user's OneDrive:

| Path | Indexes |
| - | - |
| `Reports` | The `Reports` folder and its subfolders |
| `Reports/2026` | The `2026` folder and its subfolders |
| `Reports/2026/summary.docx` | A single file |

The path picker in the Datazone UI lets you browse the folders instead of typing the path.

## Limitations

* One source connects to **one user's OneDrive**. Create another source for each additional user.
* Subfolders are indexed recursively.
* Supported file types: **PDF, CSV, DOCX, XLSX, XLS, MD, TXT**. Other files are skipped.

## Troubleshooting

| Error | Likely cause |
| - | - |
| `Microsoft sign-in failed` | Wrong tenant ID, client ID, or secret, or the secret expired. Make sure you copied the secret *Value*. |
| `Microsoft Graph denied access (403)` | Missing `Files.Read.All` / `Sites.Read.All` application permission, or admin consent not granted. |
| `Microsoft Graph error (404)` | The user principal name is wrong, or the user has no OneDrive yet. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.