← 返回
沟通协作 Key 中文

SharePoint by altf1be

Secure SharePoint file operations and Office document intelligence via Microsoft Graph API — certificate auth, Sites.Selected, read/write Word (mammoth), Exc...
通过 Microsoft Graph API 实现 SharePoint 文件安全操作与 Office 文档智能处理——证书认证、Sites.Selected、Word 读写及 Excel 等。
abdelkrim
沟通协作 clawhub v2.0.0 1 版本 99869.8 Key: 需要
★ 1
Stars
📥 747
下载
💾 28
安装
1
版本
#latest

概述

SharePoint by @altf1be

Interact with SharePoint document libraries via Microsoft Graph API using certificate-based authentication.

Setup

  1. Create an Entra app with Sites.Selected permission and certificate auth
  2. Grant site-level write access via Microsoft Graph PowerShell
  3. Set environment variables (or create .env in {baseDir}):
SP_TENANT_ID=your-azure-tenant-id
SP_CLIENT_ID=your-app-client-id
SP_CERT_PATH=/path/to/certificate.pem
SP_SITE_ID=your-sharepoint-site-id
SP_DRIVE_ID=optional-specific-drive-id
  1. Install dependencies: cd {baseDir} && npm install

Commands

File operations

# Show site and drive info
node {baseDir}/scripts/sharepoint.mjs info

# List files in library root
node {baseDir}/scripts/sharepoint.mjs list

# List files in a subfolder
node {baseDir}/scripts/sharepoint.mjs list --path "Meeting Notes/2026"

# Read file content (extracts text from Office formats)
node {baseDir}/scripts/sharepoint.mjs read --path "Report.docx"

# Upload a file
node {baseDir}/scripts/sharepoint.mjs upload --local ./report.docx --remote "Reports/Q1-2026.docx"

# Search for files
node {baseDir}/scripts/sharepoint.mjs search --query "quarterly review"

# Create folder
node {baseDir}/scripts/sharepoint.mjs mkdir --path "Meeting Notes/2026"

# Delete (requires --confirm flag)
node {baseDir}/scripts/sharepoint.mjs delete --path "Drafts/old-file.txt" --confirm

Coauthoring (checkout/checkin)

# Safe edit: checkout → upload modified file → checkin (recommended)
node {baseDir}/scripts/sharepoint.mjs edit --path "Report.docx" --local ./modified.docx --comment "Updated summary"

# Check out a file (lock for exclusive editing)
node {baseDir}/scripts/sharepoint.mjs checkout --path "Report.docx"

# Check in a file (unlock + publish)
node {baseDir}/scripts/sharepoint.mjs checkin --path "Report.docx" --comment "Reviewed and approved"

# Get an edit link to open in Office Online
node {baseDir}/scripts/sharepoint.mjs edit-link --path "Report.docx"

Supported Office formats

The read command extracts text content from:

  • .docx → full text extraction via mammoth
  • .xlsx → sheet names + cell data via exceljs
  • .pptx → slide text extraction via jszip
  • .pdf → text extraction via pdf-parse
  • .txt / .md → raw content

Output is plain text suitable for AI processing (summarization, reformatting, action item extraction).

Dependencies

  • @azure/identity — certificate-based Azure AD authentication
  • @microsoft/microsoft-graph-client — Microsoft Graph API client
  • mammoth — Word document text extraction
  • exceljs — Excel spreadsheet parsing
  • jszip — PowerPoint XML extraction
  • pdf-parse — PDF text extraction
  • commander — CLI framework
  • dotenv — environment variable loading

Security

  • Certificate auth only (no client secrets, no passwords)
  • Sites.Selected permission (access limited to one SharePoint site)
  • Path traversal prevention: ../ is rejected
  • Delete requires explicit --confirm flag
  • No tokens or secrets printed to stdout
  • File size limit: configurable max (default 50MB)

Full setup guide

For complete setup from scratch (Entra app, certificate, Sites.Selected, Key Vault):

See the GitHub repository README.

Author

Abdelkrim BOUJRAF — ALT-F1 SRL, Brussels 🇧🇪

X: @altf1be

版本历史

共 1 个版本

  • v2.0.0 当前
    2026-03-29 17:47 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,596
communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 114 📥 52,450
security-compliance

X/Twitter by altf1be

abdelkrim
Post tweets, threads, and media to X/Twitter via API v2 — secure OAuth 1.0a signing, minimal dependencies (commander + d
★ 1 📥 1,325