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

# SharePoint

> Connect SharePoint to sync documents and sites

Connect SharePoint to Realm to make documents and site content searchable. Navigate to **Settings** > **Data sources** and click **Connect** on SharePoint, or click **Reconnect** if already connected. To change permission mode, click **Reconnect with app scopes** or **Reconnect with delegated scopes**.

## Connecting SharePoint

<Steps>
  <Step title="Authorize access">
    Click **Authorize** on the SharePoint data source page. You'll be redirected to Microsoft's OAuth consent screen. Review the permissions and click **Accept**. This does not start syncing any data yet.

    <Frame caption="SharePoint data source page">
      <img src="https://mintcdn.com/realm/64355FKbBqTw20Wg/images/admin/sharepoint-connect.png?fit=max&auto=format&n=64355FKbBqTw20Wg&q=85&s=10720fbdd98716347f188d0e49c912cc" alt="SharePoint data source page showing the two-step connection flow" width="1584" height="742" data-path="images/admin/sharepoint-connect.png" />
    </Frame>

    <Frame caption="Microsoft OAuth consent screen">
      <img src="https://mintcdn.com/realm/64355FKbBqTw20Wg/images/admin/sharepoint-oauth-consent.png?fit=max&auto=format&n=64355FKbBqTw20Wg&q=85&s=f07a2117ff9f88e58919fe67d8d0d666" alt="Microsoft OAuth consent screen requesting SharePoint permissions" width="946" height="1436" data-path="images/admin/sharepoint-oauth-consent.png" />
    </Frame>
  </Step>

  <Step title="Select sites and drives">
    After accepting, you'll be redirected back to Realm. Select which SharePoint sites and OneDrive drives to sync.

    <Frame caption="Selecting sites and drives to sync">
      <img src="https://mintcdn.com/realm/64355FKbBqTw20Wg/images/admin/sharepoint-sites.png?fit=max&auto=format&n=64355FKbBqTw20Wg&q=85&s=228dbde4aa20883988e50cd06582deb4" alt="SharePoint data source page showing connected sites and available sites to add" width="1572" height="1104" data-path="images/admin/sharepoint-sites.png" />
    </Frame>
  </Step>
</Steps>

## Reconnecting expired access

If Microsoft access expires from inactivity or an admin revokes consent in Microsoft Entra, Realm marks the SharePoint connection as disconnected and notifies organization admins. Click **Reconnect** on the SharePoint data source page to authorize access again. This also restores syncing for OneNote notebooks and OneDrive drives selected through the SharePoint connection.

By default, Realm can only access files that the connecting user has access to (delegated scope). To let Realm index all files in SharePoint, you have two options:

* **Grant admin consent** in Microsoft Entra (see below)
* **Connect with app scopes** using the alternative connect button on the data source page

## Granting admin consent

To allow Realm to access all SharePoint content (not just what the connecting user can see), grant admin consent in Microsoft Entra:

1. Go to **Microsoft Entra admin center** > **Applications** > **Enterprise applications**
2. Find **Realm** in the list
3. Go to **Permissions** and click **Grant admin consent for \[your organization]**

<Frame caption="Granting admin consent in Microsoft Entra">
  <img src="https://mintcdn.com/realm/64355FKbBqTw20Wg/images/admin/sharepoint-entra-admin-consent.png?fit=max&auto=format&n=64355FKbBqTw20Wg&q=85&s=ad34a810617918328fe2956e5e32aec1" alt="Microsoft Entra admin center showing the Grant admin consent button for Realm" width="2336" height="1398" data-path="images/admin/sharepoint-entra-admin-consent.png" />
</Frame>

Both delegated and application scopes still enforce user-level permissions in search results. The scope only affects what Realm can index.

## What gets synced

| Content                               | Synced |
| ------------------------------------- | ------ |
| Documents and files in selected sites | Yes    |
| SharePoint site pages                 | Yes    |
| OneNote notebooks and pages           | Yes    |
| OneDrive files in selected drives     | Yes    |
| SharePoint lists                      | Yes    |

Realm syncs non-hidden Microsoft Lists from selected SharePoint sites as searchable list items. Document libraries continue to sync through the normal SharePoint files path.

## File size limits

Realm skips files larger than these limits during sync:

| File type                  | Default limit |
| -------------------------- | ------------- |
| Plain text files           | 20 MB         |
| Word and PDF files         | 50 MB         |
| Spreadsheet/workbook files | 10 MB         |
| PowerPoint files           | 200 MB        |

## Selecting sites and drives

After connecting, choose which SharePoint sites and OneDrive drives to sync. The data source page shows connected sites and drives, and you can add or remove them at any time. Realm only syncs content from the sites and drives you select.

## Permissions

Realm enforces SharePoint's native permission model. Users can only see documents they have access to in SharePoint.

You can override this by switching to "Everyone in this organization" on the data source settings page, which makes all synced SharePoint data visible to all Realm users.

## Restricting API access

To limit what Realm can access:

1. Create a Microsoft service account that only has access to specific sites
2. Ensure the account can consent to applications
3. Use that account when connecting SharePoint

## Required scopes

The SharePoint integration requires:

* `Sites.Read.All`
* `Files.Read.All`
* `Directory.Read.All`
* `Notes.Read.All`
