Skip to content

feat(sharepoint): new SharePoint tool plugin with OAuth, Service Principal and Each user signs in (1.0.0) - #4168

Merged
crazywoola merged 1 commit into
langgenius:mainfrom
ForeignKeyCN:feat/sharepoint-tool
Nov 2, 2026
Merged

crazywoola merged 1 commit into
langgenius:mainfrom
ForeignKeyCN:feat/sharepoint-tool

Conversation

@ForeignKeyCN

@ForeignKeyCN ForeignKeyCN commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A new Microsoft SharePoint tool plugin (tools/sharepoint), built like the reworked Outlook (#4163), Teams (#4164), OneDrive (#4165), Excel (#4166) and To Do (#4167) plugins. It works on SharePoint lists, list items and document library files through Microsoft Graph, and covers the common list, item and file operations.

The repository so far only has sharepoint_datasource, which imports documents into knowledge bases; this plugin is for workflows and agents that read and change lists and files. The README says which to use when.

Auth (same three modes as the other Microsoft plugins)

  • OAuth with optional Tenant ID and Microsoft Cloud (Global, US Government, DoD, China/21Vianet). Delegated Sites.ReadWrite.All, User.Read, offline_access.
  • Service Principal: application Sites.ReadWrite.All, or Sites.Selected with per-site grants. Sites are tenant resources, so no user has to be named. Validation reads the root site, because Entra issues an app token even without any Graph permission.
  • Each user signs in: authorization code + PKCE through a plugin endpoint (GET /sharepoint/callback) that never holds the secret; per-user tokens Fernet-encrypted in plugin storage, keyed by a hash of client_id | Dify user ID; never in tool output or logs. Sign Out of SharePoint (sharepoint_sign_out).

Tools (all prefixed sharepoint_: the new Agent rejects duplicate tool names across plugins)

Operation Tool
(site picker) sharepoint_search_sites, sharepoint_get_site (a site URL, even of a page or file in it, its ID, or root)
List: Get Many / Get sharepoint_list_lists / sharepoint_get_list (with the columns' internal names, types, required flags and choices, so an agent can write items)
Item: Get Many / Get sharepoint_list_items (OData filter, allowed on non-indexed columns; up to 5000) / sharepoint_get_item
Item: Create / Update / Delete sharepoint_create_item / sharepoint_update_item / sharepoint_delete_item
Item: Create or Update sharepoint_upsert_item: match columns → update the one match or create; more than one match is an error
(folder and file pickers) sharepoint_list_files
File: Download / Upload / Update sharepoint_download_file (up to 15 MB) / sharepoint_upload_file (a file, or text saved as a file) / sharepoint_update_file (rename and/or replace content; a rename that went through before a failed upload is reported)

Item fields are returned without SharePoint's system columns. Every tool returns typed output variables (success / error plus its fields).

Safety

  • Site IDs keep their commas; every other ID is one encoded path segment, so a value chosen by the model cannot change the request path. A site URL must be on a SharePoint host.
  • File downloads use Graph's pre-authenticated link without the bearer token; paging only follows links on the Graph host.
  • OData filter values in upsert are quoted (O'Neil → 'O''Neil').

Release Notes

  • New plugin: Microsoft SharePoint. Find sites by name or URL; list and read lists and their columns; get, filter, create, update, create-or-update and delete list items; list, download, upload and update files in a site's document library.
  • Three ways to authorize: OAuth (with tenant and national clouds), Service Principal (app-only), and Each user signs in for chat agents, where each person uses their own SharePoint permissions.
  • Every tool returns typed output variables.

Change Type

  • Documentation / non-plugin change
  • Non-LLM plugin (tools, extensions, datasource, etc.)
  • LLM plugin

Screenshots / Videos

No screenshots; setup is described step by step in the README. The per-user sign-in flow is the same as in #4163–#4167 (screenshots there).

Testing

  • Unit tests: 70 passed (pytest). They cover: site resolution from an ID, root, a site URL and a page or file URL inside the site, refusing non-SharePoint hosts; ID encoding; every tool's output variables on success and on a Graph error (a test checks every tool in the provider is covered); item simplification and the non-indexed filter header; list columns; upsert creating vs. updating, quoting, refusing several matches and missing match values; downloads without the token; uploads into folders; update with rename and content, and a failed upload after a rename; OAuth URLs per tenant and cloud; Service Principal validation; the per-user sign-in flow and validation.
  • Against a real Microsoft 365 tenant with a Service Principal (read-only): get the root site, resolve the same site from its URL, list its lists, list the document library, search sites. All returned the expected data.
  • On a self-hosted Dify (Community 1.16.1): the plugin installs, the sign-in endpoint answers, and an Each user signs in credential validates against Microsoft Entra ID.
  • Not run end to end: the write operations (items and files) against the real tenant, and the per-user sign-in through a chat. They are covered by the unit tests above.

Checklist

  • I have read the contribution guidelines
  • New plugin, version 1.0.0

…cipal and Each user signs in, covering n8n's operations (1.0.0)
@crazywoola
crazywoola deployed to tools/sharepoint November 2, 2026 01:33 — with GitHub Actions Active
@crazywoola
crazywoola merged commit c1473c3 into langgenius:main Nov 2, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
tools/sharepoint — 950fbddb Deployed Nov 2, 2026 by crazywoola via test (tools/sharepoint) #2942
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants