| name | m365-pnp-cli |
| description | CLI for Microsoft 365 - Manage Microsoft 365 tenant, SharePoint Online, Teams, OneDrive, and more. Official PnP (Patterns and Practices) CLI. |
| metadata | {"openclaw":{"requires":{"bins":"[Truncated]","node":">=20.0.0","npmPackages":"[Truncated]"},"install":["[Truncated]"],"homepage":"https://pnp.github.io/cli-microsoft365","repository":"https://github.com/pnp/cli-microsoft365","author":"Microsoft PnP (Patterns and Practices)","keywords":["microsoft365","m365","sharepoint","teams","onenote","outlook","cli","microsoft","pnp"],"npmPackage":"@pnp/cli-microsoft365"}} |
m365-pnp-cli Skill
This skill provides access to the CLI for Microsoft 365 – the official PnP (Patterns and Practices) tool for Microsoft 365 management.
⚠️ IMPORTANT FOR AGENTS
When in doubt, ALWAYS call m365 --help first to see all possibilities!
m365 --help
m365 login --help
m365 spo --help
m365 teams --help
Installation
The CLI must be installed:
npm install -g @pnp/cli-microsoft365
Or use npx (sandbox):
npx @pnp/cli-microsoft365 --help
Source & Verification
What can the CLI do?
Supported Workloads
- Microsoft Teams
- SharePoint Online
- OneDrive
- Outlook
- Microsoft To Do
- Microsoft Planner
- Power Automate
- Power Apps
- Microsoft Entra ID
- Microsoft Purview
- Bookings
- And more...
Authentication
- Device Code (default)
- Username/Password
- Client Certificate
- Client Secret
- Azure Managed Identity
- Federated Identity
Commands (Overview)
Login/Logout
m365 login
m365 logout
m365 status
SharePoint Online (spo)
m365 spo site list
m365 spo site get --url <url>
m365 spo list list --webUrl <url>
m365 spo file list
m365 spo folder add
Teams
m365 teams channel list
m365 teams channel get
m365 teams user list
m365 teams chat list
m365 teams meeting list
OneDrive
m365 onedrive drive list
m365 onedrive file list
m365 onedrive file get
Outlook
m365 outlook mail list
m365 outlook calendar list
Planner
m365 planner task list
m365 planner plan get
Azure AD / Entra ID
m365 entra user list
m365 entra group list
m365 entra app list
Usage as Assistant - IMPORTANT
⚡ First Step: ALWAYS call help!
m365 --help
m365 spo --help
m365 teams --help
m365 login --help
Basic Usage
m365 login
m365 status
m365 spo site list
m365 spo site get --url "https://contoso.sharepoint.com/sites/test"
m365 teams channel list --teamId <team-id>
m365 onedrive file list
m365 outlook mail list --folder Inbox
m365 planner task list
Output Options
m365 spo site list
m365 spo site list --output text
m365 spo site list --query "[?Template==\`GROUP#0\`].{Title:Title, Url:Url}"
Authentication
The CLI uses Device Code Flow by default:
m365 login
For automated scripts, you can also use:
- Certificate (recommended for production)
- Client Secret (less secure)
- Username/Password (testing only)
Important
- WHEN IN DOUBT: call m365 --help!
- Login required for most commands
- JSON output is easiest to parse
- JMESPath for efficient filtering
- CLI requires Node.js >= 20