Skip to main content

SharePoint

Index documents from your SharePoint sites as searchable knowledge for Squid AI agents

The SharePoint connector's functionality

The SharePoint connector reads documents from your organization's SharePoint document libraries into a knowledge base, enabling Squid AI agents to answer questions using their content:

  • You choose which documents or folders to index. Indexing a folder recursively indexes all files inside it.
  • Squid keeps indexed content in sync automatically, picking up modified, added, and deleted files every 10 minutes.
  • AI agents connected to the SharePoint connector can semantically search the indexed content and list the indexed documents.
  • Access is read-only: Squid never writes to your SharePoint sites.

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.

  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 Microsoft Graph application permissions that grant read access to your sites and files (Sites.Read.All and Files.Read.All), then grant admin consent.

Adding the SharePoint connector to your Squid application

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

  2. Click Available Connectors.

  3. Find the SharePoint 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.

Indexing documents

Documents are indexed programmatically using the @squidcloud/sharepoint-client package. A document or folder is addressed by its SharePoint site ID, drive ID, and item ID:

npm install @squidcloud/sharepoint-client
import { SharePointClient, encodeSharePointLocation } from '@squidcloud/sharepoint-client';

const sharepoint = new SharePointClient(squid, 'SHAREPOINT_CONNECTOR_ID');

// Index a document or an entire folder (recursive)
const errors = await sharepoint.indexDocumentOrFolder({
siteId: 'SITE_ID',
driveId: 'DRIVE_ID',
itemId: 'ITEM_ID',
});

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

// Remove a document or folder from the index by its listed ID...
await sharepoint.unindexDocumentOrFolder(documents[0].id);

// ...or address it directly by encoding its location
await sharepoint.unindexDocumentOrFolder(encodeSharePointLocation('SITE_ID', 'DRIVE_ID', 'ITEM_ID'));

Once indexed, documents stay current automatically through the background sync.

Using the SharePoint connector with an AI agent

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 SharePoint documents".

  4. Click Add Abilities, scroll to the Storage section, and select the SharePoint 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 SharePoint."

  6. Click on Test and try asking the agent a question about an indexed document.

Using the Squid SDK

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

await this.squid
.ai()
.agent('AGENT_ID')
.ask('What does our expense policy say about travel?', {
connectedIntegrations: [
{
integrationId: 'SHAREPOINT_CONNECTOR_ID',
integrationType: 'sharepoint',
description: 'Call this connector to search our SharePoint documents',
},
],
});