The SharePoint / OneDrive connector is a text connector that fetches files from
SharePoint sites or personal OneDrive using the Microsoft Graph API. It downloads file content
and ingests claims via db.ingest_text().
graph.microsoft.com/v1.0) with Bearer token authsite is provided, queries the SharePoint site drive; otherwise uses OneDrivedb.ingest_text()| Mode | Parameter | API path |
|---|---|---|
| SharePoint site | site="contoso.sharepoint.com:/sites/team" | /sites/{site}/drive/... |
| Personal OneDrive | Omit site | /me/drive/... |
In the Azure Portal,
register an application with the Files.Read.All delegated permission
(or Sites.Read.All for SharePoint access).
Use the OAuth 2.0 authorization code flow or client credentials flow to obtain a Bearer token. For testing, use the Graph Explorer.
$ pip install requests
conn = db.connect("sharepoint", token=os.environ["GRAPH_ACCESS_TOKEN"], site="contoso.sharepoint.com:/sites/engineering", ) result = conn.run(db)
| Parameter | Required | Default | Description |
|---|---|---|---|
token |
Yes | — | Microsoft Graph API Bearer token |
site |
No | OneDrive | SharePoint site identifier (e.g. contoso.sharepoint.com:/sites/team) |
folder_path |
No | Root | Path within the drive to list files from |
max_files |
No | 50 |
Maximum number of files to process |
extraction |
No | heuristic |
Text extraction mode: heuristic or llm |
save |
No | False |
Encrypt and persist token |
conn = db.connect("sharepoint", token=os.environ["GRAPH_ACCESS_TOKEN"], site="contoso.sharepoint.com:/sites/engineering", ) result = conn.run(db) print(f"Ingested {result.claims_ingested} claims")
conn = db.connect("sharepoint", token=os.environ["GRAPH_ACCESS_TOKEN"], max_files=100, ) result = conn.run(db)
conn = db.connect("sharepoint", token=os.environ["GRAPH_ACCESS_TOKEN"], site="contoso.sharepoint.com:/sites/docs", folder_path="/General/Reports", extraction="llm", save=True, ) result = conn.run(db)