Skip to main content

OneDrive

OneDrive

OneDrive Connector

Indexes files from your personal OneDrive, including nested folders. Uses Microsoft Graph delta queries for efficient incremental sync.

Accurate as of April 2026

Prerequisites - Before you start, make sure you have:


1. Register an application in Azure

Open the Azure portal, then navigate to App registrations.

Click New registration.

Azure App registrations page with New registration button
Go to App registrations and click "New registration".

2. Fill in the registration details

Fill in the form:

FieldValue
NameSercha (or any name you like)
Supported account typesPick what suits your account. "Accounts in any organizational directory and personal Microsoft accounts" covers both work/school and personal.
Redirect URI (Web)http://localhost:8080/api/v1/oauth/callback

Click Register.

Azure app registration form filled in with Sercha values
Fill in the registration form. The redirect URI must point to the API on port 8080.

3. Add API permissions

In the app's left nav, go to API permissions, then click Add a permission.

API permissions page with Add a permission button highlighted
Open API permissions and click "Add a permission".

Choose Microsoft Graph.

Request API permissions dialog with Microsoft Graph tile highlighted
Select Microsoft Graph.

Choose Delegated permissions — the app acts on behalf of the signed-in user.

Microsoft Graph permissions dialog with Delegated permissions option highlighted
Pick Delegated permissions.

Use the search box to find and tick each of the three scopes Sercha needs, then click Add permissions:

  • Files.Read — read the signed-in user's files
  • User.Read — read the user's profile (used to label the connection)
  • offline_access — issue refresh tokens (required; Microsoft access tokens expire after 1 hour)
Delegated permissions list with Files.Read, User.Read, and offline_access checked
Select Files.Read, User.Read, and offline_access, then click "Add permissions".
tip

No admin consent is required for a personal Microsoft account. A work/school account may need admin approval depending on your tenant policy.

4. Copy the Application (client) ID

Go back to the app's Overview page and copy the Application (client) ID — this is the value Sercha uses as MICROSOFT_CLIENT_ID.

Azure app Overview page with Application (client) ID highlighted
Copy the Application (client) ID from the Overview page.

5. Generate a client secret

In the app's left nav, go to Certificates & secrets.

App left nav with Certificates & secrets highlighted
Open Certificates & secrets.

Click New client secret.

Certificates & secrets page with New client secret button highlighted
Click "New client secret".

Give it a description (e.g. Sercha local) and pick an expiry. The default is fine. Click Add.

Add a client secret form filled in with description and expiry
Set a description and expiry, then click "Add".

Copy the Value column now. Azure only shows it once — if you navigate away, you'll need to generate a new secret. Do not copy the "Secret ID" column.

Generated client secret with the Value column highlighted
Copy the "Value" column — it's only visible on this screen.

6. Configure the provider

Add the credentials to your .env file (in your Sercha deployment directory):

.env
MICROSOFT_CLIENT_ID=your_application_client_id
MICROSOFT_CLIENT_SECRET=your_client_secret_value

7. Restart the backend

Restart the backend container so it picks up the new credentials:

Terminal
docker compose restart sercha-core
tip

No data is lost when restarting. The backend containers are stateless - all data is persisted in PostgreSQL and OpenSearch.

You can verify the provider is configured via List Providers:

curl
curl http://localhost:8080/api/v1/providers \
-H "Authorization: Bearer $TOKEN"

OneDrive should show "configured": true, "enabled": true.


From here you can continue setup using either the Admin UI or the API.

8. Connect your OneDrive account

Open http://localhost:3000/admin/sources in your browser. You'll see OneDrive listed under the available providers. Click Connect on the OneDrive row.

Your browser redirects to the Microsoft sign-in page. Pick the account whose OneDrive you want to index.

Microsoft account picker during OAuth
Choose the account whose OneDrive you want to index.

Review the requested permissions and click Accept. After authorizing, you'll be redirected back to Sercha.

9. Select folders and create a source

Choose which folders to index. Leave the selection empty to index all accessible content, or pick specific folders to narrow the scope. Then click Create Source.

OneDrive folder selector with available folders listed
Pick folders to index, or leave empty to index everything.
tip

Selecting no folders (or the root) indexes everything you have access to. Pick specific folders if you want to keep the scope small during testing.

10. Trigger a sync

Click into your source, then click Sync Now to start indexing. Once the sync completes, you'll see the indexed documents listed on the page.


What gets indexed

Office documentsWord, Excel, PowerPoint — text extracted and indexed
PDFsText layer extracted via the PDF normaliser
Plain text & markdownIndexed as-is
File metadataPath, size, created/modified timestamps

Scopes

The OAuth app requests Files.Read, User.Read, and offline_access. offline_access is required — Microsoft access tokens expire after one hour, and Sercha uses the refresh token to keep syncs running without re-prompting.

Only the signed-in user's own OneDrive is indexed. Files shared with the user (via "Shared with me") are not indexed by default.

Sync behavior

  • Initial sync: Fetches all files from selected folders (or the entire drive if no folders are specified).
  • Incremental sync: Uses Microsoft Graph delta queries — each sync returns only the items that changed since the last delta token, so incremental syncs are cheap even on large drives.
  • Token refresh: Handled automatically. The 1-hour access-token expiry is invisible to you as long as the refresh token (granted by offline_access) is valid.
  • Rate limiting: Microsoft Graph throttles aggressive clients; Sercha respects Retry-After headers and backs off automatically.
info

Delta queries mean Sercha doesn't have to refetch or re-hash files on every sync — Microsoft tells us exactly what changed. This scales well to drives with tens of thousands of files.