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

# Microsoft SharePoint

> Create workspaces synced to your Microsoft SharePoint.

Sync a workspace to a SharePoint site so any document added there is automatically ingested and indexed in LightOn. Files stay in sync: additions, updates, and deletions in SharePoint flow through to the workspace on the next import.

Synced workspaces are read-only: you cannot manually upload to or delete from them.

## From the console

The fastest path is the console UI:

1. Create a new workspace from **Workspaces → New**.
2. Open the workspace, then choose **Sync from SharePoint** in its settings.
3. Paste your Azure app credentials, pick the site and folder, and trigger the first import.

Use this if you'd rather not handle credentials yourself.

## From the API

Convert any manual workspace into a SharePoint-synced workspace by issuing a [`PATCH /api/v3/company/workspaces/{id}`](/api-reference/workspaces/update-a-company-workspace) with a `datasource` object. Conversion is one-way: you cannot revert a synced workspace back to manual.

```python theme={null}
import requests

requests.patch(
    f"https://api.lighton.ai/api/v3/company/workspaces/{workspace_id}",
    headers={"Authorization": "Bearer $LIGHTON_API_KEY"},
    json={
        "datasource": {
            "type": "sharepoint",
            "name": "Legal SharePoint",
            "credentials": {
                "client_id": "00000000-0000-0000-0000-000000000000",
                "client_secret": "YOUR_CLIENT_SECRET",
                "tenant_id": "11111111-1111-1111-1111-111111111111",
                "site_name": "Legal",
            },
            "filter_criteria": {
                "folder_path": "/Shared Documents/Contracts",
                "recursive": True,
            },
        },
    },
)
```

**Credentials**

* `client_id`, `client_secret`, `tenant_id`: from your Azure app registration. The app needs `Sites.Read.All` (or scoped `Sites.Selected`) Microsoft Graph permissions.
* `site_id` *or* `site_name` (optional): pick the SharePoint site. If both are omitted, the root site is used.

**Filter criteria**

* `folder_path` (required): path to the SharePoint folder to sync from, relative to the site
* `recursive` (optional): include subfolders

The first import is scheduled immediately. Track progress on the workspace's `sync` field returned by [`GET /api/v3/company/workspaces/{id}`](/api-reference/workspaces/retrieve-a-company-workspace).

For the full request shape, see [`PATCH /api/v3/company/workspaces/{id}`](/api-reference/workspaces/update-a-company-workspace) in the API reference.
