Microsoft 365 CLI (m365) for Openclaw

A comprehensive CLI tool for AI agents to manage Microsoft 365 services including Outlook mail, calendars, OneDrive storage, and SharePoint sites.

mrhah
v0.2.1
Mar 5, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install m365-cli

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install m365-cli using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Microsoft 365 CLI (m365)?

The m365 skill is a robust interface designed to connect AI agents with the vast Microsoft 365 ecosystem. By utilizing the Microsoft 365 CLI, this skill enables programmatic access to user-level services, allowing agents to send emails, schedule meetings, and manage cloud storage without leaving the terminal. It is a vital component for users leveraging Openclaw Skills to build sophisticated, enterprise-ready automation pipelines.

Security is a core pillar of this skill, featuring a trusted-senders whitelist to prevent prompt injection via email bodies and mandatory confirmation steps for sensitive actions like deleting files or sending messages. This ensures that while your agent is powerful, it remains operating within safe and defined boundaries.

Microsoft 365 CLI (m365) Use Cases

  • Automatically reading and summarizing important emails from trusted coworkers.
  • Creating and updating calendar events based on chat transcripts or project deadlines.
  • Syncing documents between local development environments and OneDrive or SharePoint.
  • Searching the organizational directory to resolve contact information for recipients.
  • Sharing files and managing folder permissions programmatically.

How Microsoft 365 CLI (m365) Works

  1. Authentication is established using the Device Code Flow, storing secure tokens locally for auto-refreshing sessions.
  2. The AI agent issues specific commands (e.g., mail, cal, od) to interact with the Microsoft Graph API.
  3. Security filters verify sender identity against a whitelist before displaying sensitive email content.
  4. Sensitive operations trigger user confirmation prompts to ensure human-in-the-loop oversight.
  5. Structured JSON data is returned for complex processing or rendered as tables for human readability.

Microsoft 365 CLI (m365) Setup

Install the Microsoft 365 CLI globally using npm:

npm install -g m365-cli

Log in to your Microsoft account to authorize Openclaw Skills access:

m365 login

For SharePoint access, you must add specific scopes during login:

m365 login --add-scopes Sites.ReadWrite.All

Microsoft 365 CLI (m365) Data Schema & Taxonomy

The m365 skill organizes its configuration and security metadata within the user's home directory. Output can be toggled between human-friendly tables and machine-readable JSON.

Category Location / Format Purpose
Authentication ~/.m365-cli/credentials.json Stores OAuth tokens and session state
Security ~/.m365-cli/trusted-senders.txt List of emails allowed to bypass content filtering
Commands CLI Binary Entry point for all M365 interactions
Data Output --json flag Returns raw API responses for agent processing

Microsoft 365 CLI (m365) Advanced Features

  • Multi-scope management allowing users to granularly add or exclude permissions like Mail.Send or Sites.ReadWrite.All.
  • Auto-chunking support for uploading large files (>=4MB) to OneDrive and SharePoint to ensure reliability.
  • Support for custom Azure AD app registrations via M365_TENANT_ID and M365_CLIENT_ID environment variables.
  • Comprehensive search capabilities across emails, files, sites, and organizational users.
  • Integrated trusted sender management to maintain a secure communication environment within Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*