Skip to main content
connic

SharePoint and OneDrive

By connic
Auto-sync

Keep SharePoint and OneDrive files searchable for agents

Publisher
By connic
Syncs
Documents, Images, File details
Set up in
Retrieval โ†’ Sources
Documentation
Retrieval Docs

How the SharePoint and OneDrive source works

Teams keep policies, contracts, and handbooks in SharePoint document libraries and OneDrive. The SharePoint and OneDrive source syncs those files into connic retrieval, so agents answer from the document your team maintains instead of a copy that went stale.

Connect with an app registration in your Microsoft Entra ID tenant. After the first sync, each run asks Microsoft Graph only for files that changed, so libraries with tens of thousands of files stay current without being read again. A large first sync continues over several runs until every file is indexed, and files deleted in SharePoint or OneDrive leave the retrieval on the next sync.

What gets synced

Documents
Word, Excel, PowerPoint, OpenDocument, PDF, RTF, HTML, email, and text files, extracted and chunked like uploaded files. Other file types are skipped and counted in the sync run.
Images
PNG, JPEG, GIF, and WebP files when Include images is on.
File details
Site, library, folder path, author, and last modified time are kept in entry metadata, and each entry links back to the file.
SharePoint and OneDriveActiveFile storage
Configuration
Content scope
Include imagesNo
Sync behavior
Target namespacesources.sharepoint
Sync intervalDaily
When content is deleted at the sourceRemove it from the retrieval
Recent syncsSync now
  • Completed13 Oct, 09:00
    4 new ยท 11 updated ยท 1 removed
  • CompletedManual12 Oct, 21:00
    0 new ยท 2 updated ยท 0 removed
  • Completed12 Oct, 09:00
    0 new ยท 6 updated ยท 0 removed

Set up the SharePoint and OneDrive source

Add the source under Retrieval โ†’ Sources in the environment your agents run in. Each environment keeps its own sources.

  1. In the Microsoft Entra admin center, register an app under App registrations and create a client secret for it.

  2. Under API permissions, add the Microsoft Graph application permission Sites.Selected and grant admin consent, then give the app read access to each site to sync through the site permissions endpoint in Microsoft Graph. To sync OneDrive or every site without per-site grants, use Files.Read.All instead.

  3. Enter the directory (tenant) ID, the application (client) ID, and the client secret value.

  4. List the SharePoint site URLs to sync, one per line, and optionally limit them to document library names. Add OneDrive users by their sign-in email.

  5. Optionally set a modified-since date to leave out older files.

Configuration, in depth

Every available control for connecting SharePoint and OneDrive to a project.

Connection

Directory (tenant) ID*
The Microsoft Entra ID tenant ID or a verified domain of the tenant.
Application (client) ID*
The ID of the app registration, shown on its overview page.
Client secret*
The secret value of the app registration. The sync only reads files the app can access.

Content scope

SharePoint sites
Site URLs, one per line. Every document library of a site is synced unless libraries are listed below.
Document libraries
Only sync these libraries of the listed sites, comma-separated. Leave empty to sync all of them.
OneDrive users
Sign-in emails of users whose OneDrive to sync, one per line.
Modified since
Only sync files changed on or after this date (YYYY-MM-DD). Leave empty to sync all files.
Include images
Also index image files from the libraries.

Sync behavior

Where synced content lands and how often it refreshes.

Target namespace
Retrieval namespace the synced entries are filed under. Use dots to nest, e.g. sources.notion.
Sync interval
How often the source is checked for changes. Each run only reprocesses content that changed.
When content is deleted at the source
Files deleted in SharePoint or OneDrive, or no longer matching these settings, can be removed from the retrieval on the next sync, or kept as they were last synced.

Search it from an agent

Agents search synced content with the retrieval_query tool. A small tool that pins the namespace keeps an agent to this source.

tools/knowledge.py
from connic.tools import retrieval_query


async def search_sharepoint(question: str) -> dict:
    return await retrieval_query(
        question, namespace="sources.sharepoint"
    )
agents/support-agent.yaml
version: "1.0"

name: support-agent
type: llm
model: connic/gemini-3.7-flash
system_prompt: |
  Answer only from what search_sharepoint returns.
tools:
  - knowledge.search_sharepoint

SharePoint and OneDrive retrieval source FAQ

Read-only Microsoft Graph application permissions with admin consent. Sites.Selected limits the app to the sites you grant it, and Files.Read.All covers OneDrive and every site in the tenant. The sync only reads and never writes back to Microsoft 365.

The first sync works through a large library over several runs that start automatically until every file is indexed. After that, each run only asks for files that changed, so unchanged files are neither downloaded nor charged again.

Word, Excel, PowerPoint, OpenDocument, PDF, RTF, HTML, email (EML and MSG), and text files such as Markdown, CSV, and JSON, plus images when Include images is on. Other file types and files larger than 100 MiB are skipped, and the sync run reports how many.

Yes. List only the sites and document libraries agents need, and set a modified-since date to leave out older files. Each synced file uses Project credit, so a narrower scope also makes the first sync smaller.