> For the complete documentation index, see [llms.txt](https://docs.spara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spara.com/integrations/document-sync-integrations/sharepoint.md).

# Sharepoint

How to sync SharePoint documents to Spara for AI training.

Spara syncs documents from your SharePoint Online sites and document libraries to train your AI agents. Synced documents are added to your [Knowledge](/build/knowledge.md) base, giving agents the context they need to answer questions about your products, policies, and processes.

## Setup

{% stepper %}
{% step %}

### Connect SharePoint

Navigate to [**Settings > Integrations**](https://app.spara.co/settings/integrations) and click **Authorize** next to SharePoint, then choose how Spara should authenticate:

* **User Authentication (Delegated)** — sign in with a Microsoft account. Spara accesses SharePoint as that user, so it can only see what they can see, and the connection stops working if the user leaves or their password changes.
* **Application Authentication (App-Only / Unattended)** — Spara accesses SharePoint through an application registered in your Microsoft Entra tenant, with no user attached. Your IT admin controls exactly which sites the application can read. This is Microsoft's recommended setup for ongoing syncs. See [App-only access](#app-only-access) below for the setup.
  {% endstep %}

{% step %}

### Select documents

After connecting, use the file picker to browse your SharePoint sites, document libraries, and folders. Select the files and folders you want to sync. You can select entire folders to sync all supported files within them, including subfolders.
{% endstep %}

{% step %}

### Documents sync automatically

Spara periodically syncs your selected documents and folders, picking up new files and changes automatically. Documents are processed and added to your Knowledge base.
{% endstep %}
{% endstepper %}

## App-only access

App-only access ties the connection to an application your IT team registers in Microsoft Entra instead of to an individual's account. Permissions are set centrally and can be limited to specific SharePoint sites.

{% stepper %}
{% step %}

### Register an application in Microsoft Entra

In the [Azure portal](https://portal.azure.com), open **Microsoft Entra ID > App registrations** and click **New registration**. Give it a name like "Spara SharePoint sync" and register it for your organization only (single tenant). No redirect URI is needed.

From the app's **Overview** page, copy the **Application (client) ID** and the **Directory (tenant) ID**.
{% endstep %}

{% step %}

### Create a client secret

Open **Certificates & secrets > New client secret**, choose an expiry, and copy the secret **Value** right away — it is only shown once. Set a reminder to rotate it before it expires; when it does, reconnect SharePoint in Spara with the new secret.
{% endstep %}

{% step %}

### Grant application permissions

Open **API permissions > Add a permission > Microsoft Graph > Application permissions** and add one of:

| Scope            | Use when                                                 |
| ---------------- | -------------------------------------------------------- |
| `Sites.Selected` | You want to limit Spara to specific sites (recommended). |
| `Sites.Read.All` | Spara may read every site in the tenant.                 |

Then click **Grant admin consent** for your tenant.

If you chose `Sites.Selected`, a SharePoint administrator must also grant the application **read** access to each site Spara should sync. This is done with the Microsoft Graph [site permissions API](https://learn.microsoft.com/en-us/graph/api/site-post-permissions) or PnP PowerShell:

```powershell
Grant-PnPAzureADAppSitePermission -AppId "<client id>" -DisplayName "Spara SharePoint sync" -Site "https://contoso.sharepoint.com/sites/sales" -Permissions Read
```

{% endstep %}

{% step %}

### Connect in Spara

In Spara, click **Use app-only access** on the SharePoint card and enter the **Tenant ID**, **Client ID**, and **Client Secret** from the steps above.
{% endstep %}

{% step %}

### Add your sites

Sites granted through `Sites.Selected` do not appear in the site list, because the application is not allowed to browse the tenant. In the file picker, paste each site's URL into **Add a site by URL** to load it, then select its libraries and folders as usual.
{% endstep %}
{% endstepper %}

## Supported file types

| File type                        | Supported |
| -------------------------------- | --------- |
| Word documents (`.docx`, `.doc`) | Yes       |
| PDFs (`.pdf`)                    | Yes       |
| Text files (`.txt`)              | Yes       |
| Excel (`.xlsx`, `.xls`)          | No        |
| PowerPoint (`.pptx`, `.ppt`)     | No        |
| Images, videos, audio            | No        |

{% hint style="info" %}
When you select a folder, Spara syncs all supported file types within it and its subfolders. Unsupported file types (like images or Excel files) are skipped automatically.
{% endhint %}

## How syncing works

* **Periodic sync** — Spara re-scans your selected folders on a regular interval to detect new, modified, and deleted files
* **Folder hierarchy** — The folder structure from SharePoint is preserved in the Spara Knowledge UI for easy navigation
* **Deleted files** — If a file is removed from SharePoint, it is automatically removed from your Knowledge base on the next sync

## FAQ

### Can I sync from multiple SharePoint sites?

Yes. The file picker shows all sites in your SharePoint tenant. You can select documents from any combination of sites and libraries.

### How quickly do changes appear?

Document changes are picked up during the next periodic sync cycle. For immediate updates, you can trigger a manual sync from the Knowledge page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.spara.com/integrations/document-sync-integrations/sharepoint.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
