SharePoint Connector
Sync content from a SharePoint Online document library into ScaiDrive. The connector uses the Microsoft Graph API with an Azure AD app registration, mirrors a SharePoint site's drive/library into a ScaiDrive share, and schedules recurring syncs.
Base path: /api/v1/sharepoint-connectors/
Prerequisites#
You need an Azure AD app registration with Microsoft Graph permissions on the SharePoint site. Either:
- App authentication — the connector uses an app-only token with
Sites.SelectedorSites.ReadWrite.Allpermission. Best for bulk-sync scenarios. - User authentication — the connector acts as a specific user via delegated permissions. Best when per-user access tracking matters.
For either mode, collect:
- Azure tenant ID
- Application (client) ID
- Client secret (app auth) or user auth flow details
- SharePoint site URL
- Site ID and drive ID (retrieved via Graph API or the connector's helper endpoints)
Creating a connector#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Credentials are encrypted at rest; azure_client_secret is write-only.
Configuration fields#
| Field | Notes |
|---|---|
name, description |
Display |
site_url, site_id, drive_id |
SharePoint site/drive identifiers |
library_name |
Document library name |
base_path |
Subpath inside the library |
azure_tenant_id, azure_client_id |
Azure app registration |
azure_client_secret |
App auth only |
auth_type |
app_auth or user_auth |
target_share_id, target_path |
ScaiDrive destination |
sync_direction |
bidirectional, sharepoint_to_scaidrive, scaidrive_to_sharepoint |
sync_permissions |
Mirror SharePoint ACLs to ScaiDrive |
sync_versions |
Replicate SharePoint version history |
sync_metadata |
Sync column values / metadata |
include_patterns, exclude_patterns |
Filters (same shape as SMB connector) |
conflict_resolution |
Strategy |
sync_interval_minutes |
Schedule |
User-auth flow#
For user_auth, kick off the OAuth dance:
1 2 | |
Response contains an authorization URL. Direct the user to it; when they complete consent, Microsoft redirects back to a ScaiDrive callback, and the connector stores the refresh token automatically.
Testing#
1 2 | |
Returns connection status, site accessible status, and the effective permissions the app/user has.
Discovering sites and drives#
If you don't know site_id or drive_id, the connector has helper endpoints once basic Azure credentials are set:
1 2 3 | |
Returns a list of sites the app can access, with site_id. From there:
1 2 | |
Returns drives within the site.
Azure AD identity lookup#
For identity mapping, you need ScaiDrive to resolve Azure AD users and groups:
1 2 3 4 | |
1 2 3 4 5 | |
Group search:
1 2 3 4 | |
Create identity mappings the same way as SMB:
1 2 3 4 5 6 7 8 | |
(The field is named smb_principal for consistency with the SMB connector — here it's the Azure AD object ID.)
Triggering and monitoring syncs#
1 2 3 4 5 | |
Same endpoints, same response shape as SMB jobs.
Version and metadata sync#
With sync_versions: true, the connector pulls SharePoint's version history and stores each as a ScaiDrive file version. The most recent SharePoint version becomes the current ScaiDrive version.
With sync_metadata: true, SharePoint column values (document author, custom metadata columns) are stored in the ScaiDrive file's metadata dict. They're readable via the file metadata endpoint but don't affect search unless explicitly indexed.
Limitations#
- Large libraries — Full-sync of libraries with >100k files takes hours. The connector uses Graph's delta query, so subsequent runs are fast.
- SharePoint check-outs — Files checked out in SharePoint are read-only until checked in. The connector respects this in
bidirectionalmode. - Per-file permissions — Unique SharePoint permissions (broken inheritance) are replicated if
sync_permissions: trueand identity mappings exist. Without mappings, broken permissions fall back to the connector's service identity. - OneNote notebooks — Indexed as opaque blobs. Semantic search doesn't work inside them.
Troubleshooting#
CONNECTOR_AUTH_FAILED — Azure rejected the app. Verify the client ID/secret, verify the app has the required Graph permissions, verify admin consent is granted.
CONNECTOR_UNREACHABLE — Graph API timing out or returning 5xx. Usually transient; the connector retries.
Sync errors on specific items — Often SharePoint item-level permission denials. Shown per-file in the job log.
Drift between versions — If SharePoint and ScaiDrive disagree on version history, force a resync with ?full_sync=true on the sync endpoint.
What's next#
- SMB Connector — the on-prem equivalent.
- Connectors Reference — all endpoints.
- Permissions and ACLs — how mapped permissions show up.