Install
openclaw skills install sharepointSharePoint API integration via Microsoft Graph with managed OAuth. Access SharePoint sites, lists, document libraries, and files. Use this skill when users w...
openclaw skills install sharepointAccess SharePoint via Microsoft Graph API with managed OAuth authentication.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/sharepoint/v1.0/sites/root')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
https://gateway.maton.ai/sharepoint/{native-api-path}
The gateway proxies requests to graph.microsoft.com and automatically injects your OAuth token.
All requests require the Maton API key:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Manage your SharePoint OAuth connections at https://ctrl.maton.ai.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=sharepoint&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'sharepoint'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
"status": "PENDING",
"creation_time": "2026-03-05T08:00:00.000000Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "sharepoint",
"method": "OAUTH2",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
GET /sharepoint/v1.0/sites/root
Response:
{
"id": "contoso.sharepoint.com,guid1,guid2",
"displayName": "Communication site",
"name": "root",
"webUrl": "https://contoso.sharepoint.com"
}
GET /sharepoint/v1.0/sites/{site_id}
Site IDs follow the format: {hostname},{site-guid},{web-guid}
GET /sharepoint/v1.0/sites/{hostname}:/{site-path}
Example: GET /sharepoint/v1.0/sites/contoso.sharepoint.com:/sites/marketing
GET /sharepoint/v1.0/sites?search={query}
GET /sharepoint/v1.0/sites/{site_id}/sites
GET /sharepoint/v1.0/sites/{site_id}/columns
GET /sharepoint/v1.0/me/followedSites
GET /sharepoint/v1.0/sites/{site_id}/lists
Response:
{
"value": [
{
"id": "b23974d6-a0aa-4e9b-9535-25393598b973",
"name": "Events",
"displayName": "Events",
"webUrl": "https://contoso.sharepoint.com/Lists/Events"
}
]
}
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/columns
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/contentTypes
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items
With field values (use $expand=fields):
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items?$expand=fields
Response:
{
"value": [
{
"id": "1",
"createdDateTime": "2026-03-05T08:00:00Z",
"fields": {
"Title": "Team Meeting",
"EventDate": "2026-03-10T14:00:00Z",
"Location": "Conference Room A"
}
}
]
}
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items/{item_id}?$expand=fields
POST /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items
Content-Type: application/json
{
"fields": {
"Title": "New Event",
"EventDate": "2026-04-01T10:00:00Z",
"Location": "Main Hall"
}
}
PATCH /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items/{item_id}/fields
Content-Type: application/json
{
"Title": "Updated Event Title"
}
DELETE /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items/{item_id}
Returns 204 No Content on success.
GET /sharepoint/v1.0/sites/{site_id}/drives
GET /sharepoint/v1.0/sites/{site_id}/drive
GET /sharepoint/v1.0/drives/{drive_id}
Note: Drive IDs containing ! (e.g., b!abc123) must be URL-encoded: b%21abc123
GET /sharepoint/v1.0/drives/{drive_id}/root/children
Response:
{
"value": [
{
"id": "01WBMXT7NQEEYJ3BAXL5...",
"name": "Documents",
"folder": { "childCount": 5 },
"webUrl": "https://contoso.sharepoint.com/Shared%20Documents/Documents"
},
{
"id": "01WBMXT7LISS5OMIG4CZ...",
"name": "report.docx",
"file": { "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
"size": 25600
}
]
}
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}
GET /sharepoint/v1.0/drives/{drive_id}/root:/{path}
Example: GET /sharepoint/v1.0/drives/{drive_id}/root:/Reports/Q1.xlsx
GET /sharepoint/v1.0/drives/{drive_id}/items/{folder_id}/children
Or by path:
GET /sharepoint/v1.0/drives/{drive_id}/root:/{folder_path}:/children
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/content
Or by path:
GET /sharepoint/v1.0/drives/{drive_id}/root:/{path}:/content
Returns a redirect to the download URL (follow redirects to get file content).
PUT /sharepoint/v1.0/drives/{drive_id}/root:/{filename}:/content
Content-Type: application/octet-stream
<file content>
Example:
curl -X PUT "https://gateway.maton.ai/sharepoint/v1.0/drives/{drive_id}/root:/documents/report.txt:/content" \
-H "Authorization: Bearer $MATON_API_KEY" \
-H "Content-Type: text/plain" \
-d "File content here"
POST /sharepoint/v1.0/drives/{drive_id}/root/children
Content-Type: application/json
{
"name": "New Folder",
"folder": {},
"@microsoft.graph.conflictBehavior": "rename"
}
Or in a specific folder:
POST /sharepoint/v1.0/drives/{drive_id}/items/{parent_id}/children
PATCH /sharepoint/v1.0/drives/{drive_id}/items/{item_id}
Content-Type: application/json
{
"name": "new-filename.txt"
}
To move to another folder:
PATCH /sharepoint/v1.0/drives/{drive_id}/items/{item_id}
Content-Type: application/json
{
"parentReference": {
"id": "{target_folder_id}"
}
}
POST /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/copy
Content-Type: application/json
{
"name": "copied-file.txt"
}
This is an async operation - returns 202 Accepted with a Location header for progress tracking.
DELETE /sharepoint/v1.0/drives/{drive_id}/items/{item_id}
Returns 204 No Content on success. Deleted items go to the recycle bin.
GET /sharepoint/v1.0/drives/{drive_id}/root/search(q='{query}')
Response:
{
"value": [
{
"id": "01WBMXT7...",
"name": "quarterly-report.xlsx",
"webUrl": "https://contoso.sharepoint.com/..."
}
]
}
GET /sharepoint/v1.0/drives/{drive_id}/root/delta
Returns changed items and a @odata.deltaLink for subsequent requests.
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/permissions
POST /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/createLink
Content-Type: application/json
{
"type": "view",
"scope": "organization"
}
Parameters:
type: view, edit, or embedscope: anonymous, organization, or usersResponse:
{
"id": "f0cfb2bd-ef5f-4451-9932-8e9a3e219aaa",
"roles": ["read"],
"link": {
"type": "view",
"scope": "organization",
"webUrl": "https://contoso.sharepoint.com/:t:/g/..."
}
}
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/versions
Response:
{
"value": [
{
"id": "2.0",
"lastModifiedDateTime": "2026-03-05T08:07:12Z",
"size": 25600,
"lastModifiedBy": {
"user": { "displayName": "John Doe" }
}
},
{
"id": "1.0",
"lastModifiedDateTime": "2026-03-04T10:00:00Z",
"size": 24000
}
]
}
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/versions/{version_id}
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/versions/{version_id}/content
GET /sharepoint/v1.0/drives/{drive_id}/items/{item_id}/thumbnails
Response:
{
"value": [
{
"id": "0",
"small": { "height": 96, "width": 96, "url": "..." },
"medium": { "height": 176, "width": 176, "url": "..." },
"large": { "height": 800, "width": 800, "url": "..." }
}
]
}
SharePoint/Graph API supports OData query parameters:
| Parameter | Description | Example |
|---|---|---|
$select | Select specific properties | ?$select=id,name,size |
$expand | Expand related entities | ?$expand=fields |
$filter | Filter results | ?$filter=name eq 'Report' |
$orderby | Sort results | ?$orderby=lastModifiedDateTime desc |
$top | Limit results | ?$top=10 |
$skip | Skip results (pagination) | ?$skip=10 |
Example with multiple parameters:
GET /sharepoint/v1.0/sites/{site_id}/lists/{list_id}/items?$expand=fields&$top=50&$orderby=createdDateTime desc
const response = await fetch('https://gateway.maton.ai/sharepoint/v1.0/sites/root', {
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
});
const data = await response.json();
console.log(data);
import os
import requests
response = requests.get(
'https://gateway.maton.ai/sharepoint/v1.0/sites/root',
headers={
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'
}
)
print(response.json())
{hostname},{site-guid},{web-guid}! (e.g., b!abc123) must be URL-encoded (b%21abc123)01WBMXT7NQEEYJ3BAXL5...)| Status | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 202 | Accepted (async operation started) |
| 204 | No Content (successful delete) |
| 400 | Bad request / Invalid JSON |
| 401 | Invalid or missing authentication |
| 403 | Access denied / Insufficient permissions |
| 404 | Resource not found |
| 409 | Conflict (e.g., item already exists) |
| 429 | Rate limited |