Sharepoint

From intentic/intentic · View interactive version

Sharepoint is an AI agent skill from the GitHub repository intentic/intentic. Read and write SharePoint sites, document libraries, files and lists through Microsoft Graph. Use when the user asks about SharePoint sites, team documents, shared files, or SharePoint lists.

How to use this skill

Skill file

SharePoint (connected)

App-only access through Microsoft Graph. Credentials in $SHAREPOINT_TENANT_ID, $SHAREPOINT_CLIENT_ID and

$SHAREPOINT_CLIENT_SECRET; $SHAREPOINT_HOSTNAME may hold the tenant's host (contoso.sharepoint.com).

There is no user behind this token: it is the app itself, so "my files" / OneDrive personal drives are out of

reach and /me always fails. A person's own Outlook mail, calendar, OneDrive and the libraries they can open belong

to the Microsoft 365 card (m365), signed in as that person; never move a token between the two cards. Get an

hour-long token, then call Graph with it:

sp_token() { curl -s -X POST "$SHAREPOINT_LOGIN_URL/$SHAREPOINT_TENANT_ID/oauth2/v2.0/token" \
  -d "client_id=$SHAREPOINT_CLIENT_ID" -d "client_secret=$SHAREPOINT_CLIENT_SECRET" \
  -d "scope=https://graph.microsoft.com/.default" -d "grant_type=client_credentials" | jq -r '.access_token'; }
SP=$(sp_token)   # re-run when calls start answering 401 (the token lasts ~1 hour)
sp() { local m="$1" p="$2"; shift 2; curl -s -X "$m" -H "Authorization: Bearer $SP" \
  -H "Content-Type: application/json" "https://graph.microsoft.com/v1.0/$p" "$@"; }

If sp_token answers no token, print the body: it comes back as {error, error_description} and the

description spells the cause out in words, AADSTS… code and all: quote it rather than guessing from the short

error alone. A 403 on a call that looks right is almost always the

missing piece from setup: admin consent was never granted, or the app has Sites.Selected and nobody granted it

this site. Say that rather than "the site does not exist".

Notes: a site id is a comma-joined triple (contoso.sharepoint.com,<guid>,<guid>), ugly but ordinary, pass it

whole. Escape $ in Graph's own query params inside double quotes (\$top, \$select, \$filter) or the shell

eats them. Page with .["@odata.nextLink"], which is a full URL: call it directly with the bearer header.

Errors arrive as {error: {code, message}}; quote the message. Writes land as the app, not as a person, and

show in version history as such: say what you are about to change before changing shared documents.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.