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

# OneDrive

## Required Scopes

To configure a Sync for OneDrive, you need to request the following scopes from your Microsoft OAuth application:

* `Files.Read.All`
* `Sites.Read.All`

Learn more about configuring scopes for your app in [Adding Integrations](/getting-started/adding-an-integration#create-a-developer-app).

## Synced Objects

OneDrive supports the following Synced Objects:

* [Files](/managed-sync/api/file-schema)
* [Permissions](/managed-sync/permissions-api)

## Files

Send a request to [Enable Sync](/managed-sync/api/enable-a-sync) to start a file sync.

Syncs for OneDrive can be created with one of the following configurations:

* **Drive Sync**: All files in the specified drive (or the default drive) will be synced.
* **Folder Sync**: Only files in the specified folder will be synced (recursively including all subfolders by default).

<Tabs>
  <Tab title="Drive Sync">
    ```json Example theme={null}
    {
        "integration": "onedrive",
        "pipeline": "files",
        "configuration": {
          "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd"
        }
    }
    ```

    **Configuration options:**

    <ParamField path="driveId" type="string">
      A OneDrive Drive ID to limit the Sync scope to a specific drive. If not specified, the Sync will use the user's default drive.
    </ParamField>

    <ParamField path="mimeTypes" type="string[]">
      An optional array of MIME types to filter synced files. Only files matching the specified MIME types will be synced.
    </ParamField>
  </Tab>

  <Tab title="Folder Sync">
    ```json Example theme={null}
    {
        "integration": "onedrive",
        "pipeline": "files",
        "configuration": {
          "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
          "folderId": "01ABCDEF2345GHIJKL/XYZ1234567890!123"
        }
    }
    ```

    **Configuration options:**

    <ParamField path="driveId" type="string">
      A OneDrive Drive ID where the folder is located. If not specified, the Sync will use the user's default drive.
    </ParamField>

    <ParamField path="folderId" type="string" required>
      A OneDrive Folder ID to limit the Sync scope to a specific folder.
    </ParamField>

    <ParamField path="shallowSync" type="boolean">
      Set to `true` to sync only the direct children of the specified folder, without recursing into subfolders. Defaults to `false`.
    </ParamField>

    <ParamField path="mimeTypes" type="string[]">
      An optional array of MIME types to filter synced files. Only files matching the specified MIME types will be synced.
    </ParamField>
  </Tab>
</Tabs>

## Choosing Files and Folders

You can allow your user to select files from their OneDrive account in your app with the OneDrive File Picker provided by the Paragon SDK.

**Showing the File Picker**

Use the Paragon SDK in your frontend application to show the File Picker in your app.

The SDK provides an `ExternalFilePicker` class to load OneDrive's JavaScript into your page and authenticate with your user's connected OneDrive account.

```javascript theme={null}
let picker = new paragon.ExternalFilePicker("onedrive", {
    onFileSelect: (files) => {
        // Handle file selection
    }
});

// Loads external dependencies and user's access token
await picker.init();

// Open the File Picker
picker.open();
```

You can configure the File Picker to listen for additional callbacks or to restrict allowed file types. Learn more about configuring File Picker options in the [SDK Reference](/apis/api-reference#externalfilepicker).
