# Microsoft SharePoint Connector Connect Freddy to Microsoft SharePoint to access files, documents, and data from your SharePoint sites and drives. ## Prerequisites - Application (client) ID - Directory (tenant) ID - Client secret - Drive name (optional) - Folder path (optional) ## Setup Guide ### Step 1: Create Azure AD Application The Microsoft Graph API uses OAuth for authentication. You need to create an application in Azure Portal to get the required credentials. 1. Login to [Azure Portal](https://portal.azure.com/#home) 2. Click the upper-left menu icon and select **Azure Active Directory** 3. Select **App Registrations** 4. Click **New registration** 5. Register the application: - **Name:** `Freddy SharePoint Integration` - **Supported account types:** Accounts in this organizational directory only 6. Click **Register** 7. **Copy the `client_id` and `tenant_id`** from the overview page ### Step 2: Create Client Secret 1. In your app registration, select **Certificates & secrets** 2. Click **New client secret** 3. Configure: - **Description:** `Freddy SharePoint client secret` - **Expires:** Choose appropriate expiration (recommended: 12 months) 4. Click **Add** 5. **Copy the client secret value immediately** (it won't be shown again) ### Step 3: Configure API Permissions 1. Select **API permissions** 2. Click **Add a permission** 3. Select **Microsoft Graph** 4. Select **Application permissions** 5. Add the following permission: - `Files.Read.All` - Read all files in SharePoint 6. Click **Add permissions** 7. Click **Grant admin consent** (requires admin privileges) ### Step 4: Configure in Freddy ```bash curl https://api.aitronos.com/v1/personal-connectors/configurations \ -H "api-key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "connectorId": "sharepoint", "name": "My SharePoint", "configuration": { "tenantId": "your-tenant-id", "searchScope": "ALL", "folderPath": "", "siteUrl": "" }, "credentials": { "clientId": "your-client-id", "clientSecret": "your-client-secret" } }' ``` ```python import os import requests response = requests.post( "https://api.aitronos.com/v1/personal-connectors/configurations", headers={ "api-key": os.environ["FREDDY_API_KEY"], "Content-Type": "application/json" }, json={ "connectorId": "sharepoint", "name": "My SharePoint", "configuration": { "tenantId": "your-tenant-id", "searchScope": "ALL", "folderPath": "", "siteUrl": "" }, "credentials": { "clientId": "your-client-id", "clientSecret": "your-client-secret" } } ) print(response.json()) ``` ```javascript const response = await fetch( "https://api.aitronos.com/v1/personal-connectors/configurations", { method: "POST", headers: { "api-key": process.env.FREDDY_API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ connectorId: "sharepoint", name: "My SharePoint", configuration: { tenantId: "your-tenant-id", searchScope: "ALL", folderPath: "", siteUrl: "" }, credentials: { clientId: "your-client-id", clientSecret: "your-client-secret" } }) } ); console.log(await response.json()); ``` ## Configuration Options | Field | Type | Description | | --- | --- | --- | | `tenantId` | string | Your Azure AD tenant ID | | `searchScope` | string | Where to search: `ACCESSIBLE_DRIVES`, `SHARED_ITEMS`, or `ALL` (default) | | `folderPath` | string | Specific folder path to search (empty = all folders) | | `siteUrl` | string | SharePoint site URL (empty = main site) | ### Search Scope Options - **ACCESSIBLE_DRIVES** - All SharePoint drives the user can access - **SHARED_ITEMS** - Shared items the user has access to - **ALL** - Search both drives and shared items (default) ### Multi-Site Support To access files in a specific SharePoint site, provide the site URL: ```json { "siteUrl": "https://yourcompany.sharepoint.com/sites/marketing" } ``` To iterate all sub-sites: ```json { "siteUrl": "https://yourcompany.sharepoint.com/sites/" } ``` ## Supported File Formats The connector supports multiple file formats: | Format | Extensions | Notes | | --- | --- | --- | | CSV | `.csv` | Configurable delimiters, encoding | | Parquet | `.parquet` | Column-oriented storage | | Avro | `.avro` | Schema-based serialization | | JSONL | `.jsonl` | Line-delimited JSON | | Documents | `.md`, `.txt`, `.pdf`, `.docx` | Text extraction | ## Path Patterns Use glob-style patterns to match files: | Pattern | Description | | --- | --- | | `**` | Match all files | | `**/*.csv` | All CSV files | | `myFolder/**/*.csv` | CSV files under myFolder | | `**/prefix*.csv` | CSV files with specific prefix | | `reports/2024/**` | All files in 2024 reports folder | ### Pattern Examples ```json { "globs": "**/*.csv|**/*.xlsx" } ``` This matches all CSV and Excel files in any folder. ## Sync Modes | Mode | Supported | | --- | --- | | Full Refresh | ✅ Yes | | Incremental | ✅ Yes | ## Data Type Mapping | SharePoint Type | Freddy Type | | --- | --- | | `string` | `string` | | `number` | `number` | | `array` | `array` | | `object` | `object` | ## Rate Limits The connector respects Microsoft Graph API [throttling limits](https://docs.microsoft.com/en-us/graph/throttling). Implement exponential backoff for 429 responses. ## Troubleshooting ### Authentication Failures **Error:** `Failed to authenticate with Microsoft Graph` **Solutions:** 1. Verify `client_id`, `tenant_id`, and `client_secret` are correct 2. Check the client secret hasn't expired 3. Ensure admin consent was granted for API permissions 4. Verify the app registration is in the correct tenant ### Permission Errors **Error:** `Access denied to SharePoint resources` **Solutions:** 1. Verify `Files.Read.All` permission is granted 2. Ensure admin consent was provided 3. Check the user has access to the requested site/drive ### No Files Found **Error:** Empty results when syncing **Solutions:** 1. Verify the folder path is correct 2. Check the search scope includes the target location 3. Ensure the site URL is correct for multi-site setups 4. Verify glob patterns match your file names ## Next Steps - [Personal Connectors Overview](/docs/documentation/personal-connectors/overview) - [Connector Setup Guide](/docs/documentation/personal-connectors/connectors-guide)