Skip to main content

Microsoft OneDrive

Index your organization's OneDrive files as searchable knowledge for Squid AI agents

The OneDrive connector's functionality

The OneDrive connector reads the files in your Microsoft 365 organization's OneDrive accounts into a knowledge base, enabling Squid AI agents to answer questions using their content:

  • Squid indexes the OneDrive files of every user in your tenant and keeps the index in sync automatically: new users are discovered hourly, and file changes, renames, and deletions are picked up every 10 minutes.
  • AI agents connected to the OneDrive connector can semantically search the indexed content and list the indexed documents. Search results identify which user's drive each result came from.
  • Access is read-only: Squid never writes to your OneDrive.

Creating a Microsoft Entra app registration

The connector authenticates using an app registration with application permissions (no per-user sign-in):

  1. In the Azure Portal, go to App registrations and click New registration. Choose a single-tenant registration.

  2. After creation, note the Application (client) ID and Directory (tenant) ID from the Overview tab.

  3. Under Certificates & secrets, create a new client secret and save its value. Client secrets expire (6 months by default, 24 months maximum), and syncing silently stops when the secret lapses. Choose an expiry you can track, and update the connector with a new secret in the Squid Console before then.

  4. Under API permissions, add the following Microsoft Graph application permissions, then grant admin consent:

    • Files.Read.All - To read files from users' drives
    • User.Read.All - To enumerate the users in the tenant

Adding the OneDrive connector to your Squid application

  1. Navigate to the Connectors tab in the Squid Console.

  2. Click Available Connectors.

  3. Find the Microsoft OneDrive connector, and select Add Connector.

  4. Provide the following configuration details:

Connector ID: A string that uniquely identifies the connector in your code. This cannot be changed later.

Client ID: The Application (client) ID from your app registration.

Tenant ID: The Directory (tenant) ID from your app registration.

Client Secret: The client secret you created. It is stored securely as a Squid secret.

After the connector is added, Squid starts the initial sync of your tenant's drives. Allow some time for indexing to complete before testing searches.

note

The connector supports Microsoft 365 work and school tenants (application permissions require admin consent). It always indexes the drives of all users in the tenant; there is currently no per-user or per-folder selection.

Using the OneDrive connector in your application

No-code Studio

  1. Navigate to the Studio tab in the Squid Console.

  2. Click Create AI Agent.

  3. Provide an agent ID and description, such as "docs-agent" and "This agent answers questions using our OneDrive files".

  4. Click Add Abilities, scroll to the Storage section, and select the Microsoft OneDrive connector you created earlier.

  5. Give a description for how the agent should use this connection, such as "Call this when a user asks about content stored in OneDrive."

  6. Click on Test and try asking the agent "Search OneDrive for the Q3 planning docs".

Using the Squid SDK

If you are creating your AI agent with the Squid SDK, connect the OneDrive connector by adding it to the connectedIntegrations option of the ask() function:

await this.squid
.ai()
.agent('AGENT_ID')
.ask('Find the latest onboarding checklist in OneDrive', {
connectedIntegrations: [
{
integrationId: 'ONEDRIVE_CONNECTOR_ID',
integrationType: 'onedrive',
description: 'Call this connector to search OneDrive files',
},
],
});

Using the npm package

For programmatic access from your backend code, install the @squidcloud/onedrive-client package:

npm install @squidcloud/onedrive-client
import { OneDriveClient } from '@squidcloud/onedrive-client';

const onedrive = new OneDriveClient(squid, 'ONEDRIVE_CONNECTOR_ID');

// List everything that has been indexed
const documents = await onedrive.listIndexedDocuments();

// Trigger a full re-sync of all users' drives
await onedrive.syncAllUsers();