m365-pnp-cliCLI for Microsoft 365 - Manage Microsoft 365 tenant, SharePoint Online, Teams, OneDrive, and more. Official PnP (Patterns and Practices) CLI.
Install via ClawdBot CLI:
clawdbot install thomyg/m365-pnp-cliThis skill provides access to the CLI for Microsoft 365 – the official PnP (Patterns and Practices) tool for Microsoft 365 management.
When in doubt, ALWAYS call m365 --help first to see all possibilities!
# Always call help when unsure!
m365 --help
# For specific commands:
m365 login --help
m365 spo --help
m365 teams --help
The CLI must be installed:
npm install -g @pnp/cli-microsoft365
Or use npx (sandbox):
npx @pnp/cli-microsoft365 --help
m365 login # Device Code Login
m365 logout # Logout
m365 status # Check login status
m365 spo site list # List all sites
m365 spo site get --url <url> # Get site details
m365 spo list list --webUrl <url> # Lists in a site
m365 spo file list # List files
m365 spo folder add # Create folder
m365 teams channel list # List channels
m365 teams channel get # Get channel details
m365 teams user list # List team members
m365 teams chat list # List chats
m365 teams meeting list # List meetings
m365 onedrive drive list # OneDrive Drives
m365 onedrive file list # List files
m365 onedrive file get # Get file content
m365 outlook mail list # List emails
m365 outlook calendar list # List calendar events
m365 planner task list # Planner Tasks
m365 planner plan get # Get plan details
m365 entra user list # List users
m365 entra group list # List groups
m365 entra app list # List apps
# When in doubt - call help first!
m365 --help
# For specific commands:
m365 spo --help
m365 teams --help
m365 login --help
# Login (Device Code Flow)
m365 login
# Check status
m365 status
# SharePoint: List sites
m365 spo site list
# SharePoint: Get specific site
m365 spo site get --url "https://contoso.sharepoint.com/sites/test"
# Teams: List channels
m365 teams channel list --teamId <team-id>
# OneDrive: Files
m365 onedrive file list
# Outlook: Emails
m365 outlook mail list --folder Inbox
# Planner: Tasks
m365 planner task list
# As JSON (default)
m365 spo site list
# As text
m365 spo site list --output text
# Filter with JMESPath
m365 spo site list --query "[?Template==\`GROUP#0\`].{Title:Title, Url:Url}"
The CLI uses Device Code Flow by default:
m365 login
# → You'll receive a code on another device
# → Use that code to authenticate with Microsoft
For automated scripts, you can also use:
Generated Mar 1, 2026
IT administrators can use the CLI to automate routine Microsoft 365 tenant management tasks, such as listing SharePoint sites, managing Teams channels, and auditing user access in Entra ID. This reduces manual effort and ensures consistent configurations across the organization, improving operational efficiency.
Developers building solutions on SharePoint Online can leverage the CLI to programmatically create and configure sites, lists, and files. This enables rapid prototyping and deployment of custom applications, streamlining development workflows and reducing reliance on manual UI operations.
Compliance officers can utilize the CLI to audit Microsoft 365 data, such as retrieving file lists from OneDrive or SharePoint for compliance checks. This helps ensure data governance policies are met and simplifies reporting processes for regulatory requirements.
Project managers can use the CLI to set up and manage Teams channels, Planner tasks, and Outlook calendars for project teams. This facilitates organized collaboration, automates initial project setup, and keeps all tools synchronized across Microsoft 365 workloads.
Support technicians can employ the CLI to quickly diagnose issues by checking user login status, listing user permissions, or retrieving specific file details in SharePoint. This speeds up troubleshooting, reduces downtime, and enhances user support experiences.
MSPs can integrate the CLI into their service offerings to automate client Microsoft 365 management, such as tenant monitoring, backup configurations, and security audits. This allows for scalable, subscription-based services that reduce manual labor and increase client retention through efficient support.
SaaS companies can embed the CLI into their platforms to enable seamless Microsoft 365 integrations, such as syncing data between their app and SharePoint or Teams. This enhances product value, attracts enterprise customers, and generates revenue through premium integration features or tiered pricing.
Consulting firms can use the CLI to deliver custom automation solutions for clients, such as building scripts for data migration, reporting dashboards, or workflow optimizations. This creates project-based revenue streams and long-term support contracts, leveraging expertise in Microsoft 365 ecosystems.
💬 Integration Tip
Always call m365 --help first to explore commands and use JSON output for easier parsing in automated scripts. Ensure Node.js >=20 is installed and authentication is set up before running commands.
Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
Command-line tool to manage Google Workspace services including Gmail, Calendar, Drive, Sheets, Docs, Slides, Contacts, Tasks, People, Groups, and Keep.
Runs shell commands inside a dedicated tmux session named claw, captures, and returns the output, with safety checks for destructive commands.
A modern text-based browser. Renders web pages in the terminal using headless Firefox.
Write robust, portable shell scripts. Use when parsing arguments, handling errors properly, writing POSIX-compatible scripts, managing temp files, running commands in parallel, managing background processes, or adding --help to scripts.
NotebookLM CLI wrapper via `node {baseDir}/scripts/notebooklm.mjs`. Use for auth, notebooks, chat, sources, notes, sharing, research, and artifact generation/download.