Skip to main content

SharePoint Integration

Connect a SharePoint folder to an xMagic Drive folder so your agents can search and use its files. xMagic imports and indexes the files once, then keeps the two folders in sync. You decide whether changes only flow from SharePoint into xMagic, or whether agents can also write back to SharePoint.

This guide uses a running example: the Operations site has a Release Notes folder that a release assistant agent should read and, later, update.

WhereWhat you do there
xMagic DriveCreate the folder, connect SharePoint and choose how it syncs
xMagic ComposerGive an agent access to the synced folder
Microsoft Entra admin center and Graph ExplorerOnly for Client Credentials: register an Azure app and grant it access to the site

Choose how changes sync​

Every SharePoint integration pulls changes from SharePoint. Two-way sync is optional and also pushes the agents' changes back.

ModeSharePoint → xMagicxMagic → SharePoint
Pull only (default)New, updated and deleted files are reflected in xMagicNothing. Agent changes stay in xMagic.
Two-waySame as pull onlyAgents can create folders and create, edit or delete files in SharePoint, within the folders and permissions you give them

For example, with two-way sync, when the agent edits Release Notes/2026-11.docx in xMagic, the new version is saved to the same file in SharePoint. With pull only, the edit stays in xMagic and the SharePoint file is untouched.

When changes move:

  • SharePoint → xMagic: on the schedule you set, or whenever you select Sync Now in Integration Details.
  • xMagic → SharePoint: right after the agent makes the change. Changes that could not be saved are retried on the next sync.

Before you start​

You need:

  • Access to xMagic Drive and to the agent you want to connect.
  • A Microsoft 365 account that can open the SharePoint site and folder. For two-way sync, it must also be able to edit them.
  • For Client Credentials only: an Entra administrator who can register an app and grant it access to the site. See Set up an Azure app.

Step 1: Choose an xMagic folder​

  1. In xMagic, open Drive.
  2. Create a folder (for example Operations) or open an existing one.
  3. Select Add data → SharePoint.
One integration per folder tree

A folder can't get a sync integration if the folder itself, one of its parent folders or one of its subfolders already has one. Choose a separate folder instead.


Step 2: Choose how xMagic signs in to SharePoint​

MethodBest forWhat you need
OAuth (recommended)Most teams. xMagic acts on behalf of the person who signs in.A Microsoft 365 account with access to the folder
Client Credentials (Azure App)Organizations that don't want the sync to depend on a person's accountThe Tenant ID, Client ID and Client Secret of an Azure app
  • OAuth: select Import from SharePoint and sign in with Microsoft in the popup. xMagic asks for read-only access at this point. Edit access is only requested later, if you turn on two-way sync. Then select Continue.
  • Client Credentials: enter the Tenant ID, Client ID and Client Secret of your Azure app and select Continue.
tip

If nothing happens when you select Import from SharePoint, allow popups for xMagic in your browser and try again.


Step 3: Enter the site and the folders to sync​

FieldWhat to enterExample
Site URLThe address of the SharePoint sitehttps://example.sharepoint.com/sites/Operations
Base file pathThe folder (or file) to sync, inside that sitehttps://example.sharepoint.com/sites/Operations/Shared%20Documents/Release%20Notes

For Base file path you can paste:

  • the folder's address, as in the example above,
  • the address shown in your browser while the folder is open in SharePoint (it ends in AllItems.aspx?id=...), or
  • a sharing link created with Copy link in SharePoint.

To sync several folders into the same xMagic folder, separate them with commas:

https://example.sharepoint.com/sites/Operations/Shared%20Documents/Release%20Notes,
https://example.sharepoint.com/sites/Operations/Shared%20Documents/Runbooks
Where agents can create new files

Agents can always create files inside the synced subfolders, such as Release Notes/2026. To let them create files at the top level of the xMagic folder too, enter a single base file path. With several paths, xMagic can't know which SharePoint folder a new top-level file belongs to.

Select Continue.


Step 4: Configure syncing​

  1. Enter a Description of the content, for example Release notes. It is required.
  2. Turn on Use OCR if the folder has scanned documents or images with text you want the agent to read.
  3. To pull changes on a schedule, turn on Sync files automatically and enter the Sync interval (minutes). The minimum is 60 minutes and the default is 1440 minutes (once a day). The interval counts from the end of the previous sync.
  4. For two-way sync, turn on Push xMagic changes to SharePoint and give xMagic edit access:
    • OAuth: select Grant access and approve edit access in the Microsoft popup. The row then shows Edit access granted. Finish stays disabled until you do this.
    • Client Credentials: the Azure app must already be allowed to write to the site. See Grant access to the site.
  5. With two-way sync on, choose what happens under If a file changed in both places since the last sync:
OptionWhat happensExample: the agent and a colleague both edited 2026-11.docx
Always keep xMagic changes (default)The xMagic version overwrites the SharePoint fileThe agent's version is saved to SharePoint
Always keep SharePoint changesThe SharePoint version replaces the agent's changeThe colleague's version is copied into xMagic and the agent's edit is dropped
  1. Select Finish. xMagic imports and indexes the files. This can take a while for large folders.

You can change the description, schedule, OCR, two-way sync and the conflict option later in Integration Details (see Manage the integration).


Step 5: Give an agent access to the folder​

  1. In Composer, open the agent's Configuration.
  2. Under Folders, select the synced folder. You can also pick just a subfolder. For example, attaching Operations/Release Notes shows it to the agent as drive://Release Notes/.
  3. Choose what the agent may do in that folder:
PermissionThe agent canNeeded for
NoneRead and search filesAnswering questions about the files
CreateCreate files and foldersDrafting a new release note
UpdateEdit files and foldersCorrecting an existing release note
DeleteDelete filesRemoving an outdated release note
Confirm deleteAsk you to approve each deletion first (available once Delete is on)Keeping a person in control of deletions
  1. Select Save.
warning

With Delete on and Confirm delete off, the agent can delete files without asking. With two-way sync, those files are also deleted in SharePoint.

These permissions apply in xMagic. With two-way sync, the SharePoint account or Azure app must also be allowed to make the same change in SharePoint.


Step 6: Test it​

Wait until the import finishes, then:

  • Pull only: ask the agent about a file in the folder, for example "What changed in the November release?". Then edit the file in SharePoint, select Sync Now and ask again.
  • Two-way: turn on Create and ask the agent to create a sample file, for example "Create a draft called release-checklist.md in Release Notes". Check that the file appears in the SharePoint folder.

Manage the integration​

In Drive, open the synced folder's integration to see Integration Details:

ActionEffect
Sync NowPull the latest SharePoint changes and push pending agent changes now
SaveApply changes to the description, sync schedule, OCR, two-way sync or conflict option
Go to FolderOpen the synced folder in Drive
DeleteRemove the integration

If you turn on two-way sync later on an OAuth integration, select Grant access to approve edit access before saving.


Set up an Azure app (Client Credentials only)​

Skip this section if you use OAuth. With Client Credentials, xMagic signs in as an Azure app instead of a person, so the app needs its own access to the site.

Register the app​

  1. Open the Microsoft Entra admin center and go to Entra ID → App registrations → New registration.
  2. Enter a name (for example xMagic SharePoint sync), keep Single tenant and select Register. No redirect URI is needed.
  3. On Overview, copy the Directory (tenant) ID and the Application (client) ID. They go into Tenant ID and Client ID in xMagic.

Create a client secret​

  1. In the app, open Certificates & secrets → New client secret and select Add.
  2. Copy the secret Value right away. Microsoft shows it only once and it goes into Client Secret in xMagic.

Grant access to the site​

Choose how much of SharePoint the app can reach:

Permission modelThe app can reachPull onlyTwo-way
Sites.Selected (recommended)Only the sites you grant it, one by oneSites.Selected + read role on the siteSites.Selected + write role on the site
Tenant-wideEvery SharePoint site in your organizationSites.Read.AllSites.ReadWrite.All

In both cases xMagic only syncs the folders you entered as Base file path.

Add the API permission

  1. In the app, open API permissions → Add a permission → Microsoft Graph → Application permissions.
  2. Add Sites.Selected (or the tenant-wide permission you chose).
  3. Select Grant admin consent for your organization. An Entra administrator must do this.

If you chose a tenant-wide permission, you are done. With Sites.Selected, the app has no access to any site until you grant it below.

Grant the app a role on the site

Use Graph Explorer signed in as a SharePoint Administrator (or higher) who is a member of the site. Graph Explorer needs the delegated Sites.FullControl.All permission for this. If it is missing under Modify Permissions, open the profile menu and select Consent to permissions.

  1. Get the site ID. Open GET https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{site-name} in Graph Explorer, replace the placeholders with your site's hostname and name, and select Run query. For the example site:

    GET https://graph.microsoft.com/v1.0/sites/example.sharepoint.com:/sites/Operations

    Copy the id from the response. It looks like example.sharepoint.com,1a2b3c4d-...,5e6f7a8b-....

  2. Grant the role. Open POST https://graph.microsoft.com/v1.0/sites/{site-id}/permissions in Graph Explorer and replace {site-id} with the ID you copied. Under Request Headers, add Content-Type with the value application/json. Paste this into Request Body, with your app's client ID and name:

    {
    "roles": ["write"],
    "grantedToIdentities": [
    {
    "application": {
    "id": "YOUR-APPLICATION-CLIENT-ID",
    "displayName": "xMagic SharePoint sync"
    }
    }
    ]
    }

    Use ["read"] instead of ["write"] for pull-only sync. Select Run query: the response is 201 Created.

Repeat both requests for every site you want to sync.


Troubleshooting​

ProblemWhat to check
Microsoft says admin approval is needed when you sign inYour organization requires an administrator to approve apps. Ask an Entra administrator to review and approve the permissions requested by the xMagic SharePoint app.
SharePoint site not foundThe Site URL must be the site's address, such as https://example.sharepoint.com/sites/Operations, not a folder or file address.
Path not found in SharePoint or Access denied to pathThe Base file path must be inside the site you entered, and the account or Azure app must be able to open it.
Graph Explorer returns 403 Access deniedGraph Explorer has the delegated Sites.FullControl.All permission, and the signed-in account is a SharePoint Administrator and a member of the site.
Graph Explorer returns 400 Invalid requestThe site ID, client ID and app name in the body, and the Content-Type: application/json header.
A file is missing in xMagicSelect Sync Now. If it is still missing, check that it is inside a synced folder and that the account or Azure app can open it.
An agent change didn't reach SharePointPush xMagic changes to SharePoint is on, the account or Azure app can edit the folder, and the agent has the right permission in Composer. For a deletion, check whether Composer is waiting for your approval.
The agent can't create a file at the top of the folderThe integration syncs several base file paths, so xMagic doesn't know where the file belongs. Ask the agent to create it in a subfolder, or use a single base file path.