Skip to main content

How to connect an AI agent to Sharepoint and Lexful to transfer documents

How to connect Microsoft Copilot to Sharepoint so an AI agent can pull documents out of Sharepoint and add them to Lexful.

Disclaimer: This document is provided for general reference only. Lexful is not affiliated with, endorsed by, or responsible for Microsoft products or services. Third-party features, settings, and procedures may change without notice. For support with any topic outside the Lexful platform, please consult the vendor's official documentation and support resources.


​
You may want to connect your AI agent (like Copilot, Claude, etc.) to Sharepoint to pull documents out of Sharepoint and add them to Lexful.
​
There are two different setups, depending on what "AI agent" means for you.
​

Path A: The agent lives inside Microsoft (Copilot Studio or M365 Copilot)

This is the native route. You don't really "connect" Copilot to SharePoint. You add SharePoint as a knowledge source on the agent.

  1. Check licensing. Users need a Microsoft 365 Copilot license, or the tenant needs Copilot Studio capacity (pay-as-you-go or message packs). SharePoint grounding needs the tenant to be on Entra ID authentication.

  2. Create the agent. In Copilot Studio (copilotstudio.microsoft.com), create an agent. For something simpler, build a SharePoint agent from the site itself, or a declarative agent in M365 Copilot.

  3. Add SharePoint knowledge. Go to Knowledge → Add knowledge → SharePoint and paste site, library, or folder URLs. There are two modes:

    • Live search: queries SharePoint at runtime through Graph and Semantic Index.

    • Uploaded/synced files: Dataverse indexes the files, which usually gives better retrieval on large documents.

  4. Set authentication. Use "Authenticate with Microsoft" (Entra ID) so the agent respects each user's SharePoint permissions. Users only get answers from files they can already open.

  5. Test and publish. Publish to Teams, M365 Copilot chat, or a website.

Path B: An external agent pulls documents from SharePoint (e.g. Claude, or your own agent)

Copilot isn't needed here. You go straight to Microsoft Graph:

  1. Register an app in Entra ID (App registrations).

  2. Grant Graph permissions. For delegated access, use Sites.Read.All and Files.Read.All. The better practice is Sites.Selected, which limits the app to specific sites. A tenant admin then grants the app access per site.

  3. Choose an auth flow. Use delegated OAuth if the agent acts as a user. Use client credentials (app-only) for a backend service.

  4. Call the Graph endpoints:

    • /sites/{site-id}/drives lists document libraries.

    • /drives/{drive-id}/root/children browses files.

    • /drives/{drive-id}/items/{id}/content downloads a file.

    • /search/query runs a search across the tenant.

  5. Wrap it as an MCP server (optional) so any MCP-compatible agent can use it. Microsoft keeps a catalog of official MCP servers, and there are several community SharePoint MCP servers you can start from.

Gotchas

  • Admin consent. Almost every step needs a Global or SharePoint admin to approve it, so line that person up first.

  • Oversharing. Copilot and Graph expose everything a user can technically access. Run a permissions review (for example with SharePoint Advanced Management) before rollout.

  • File limits. Copilot Studio caps the file sizes and types it handles in live mode. Large PDFs and scanned files often need the upload/Dataverse route instead.

Sources:

Did this answer your question?