Ms365 Cli
by @thecfguy
Manage Microsoft 365 Emails and Calendar using the ms365 CLI. Trigger this skill when the user needs to "read my email", "send an email", "search emails", "c...
clawhub install ms365-cliπ About This Skill
name: ms365-cli description: Manage Microsoft 365 Emails and Calendar using the ms365 CLI. Trigger this skill when the user needs to "read my email", "send an email", "search emails", "check my calendar", "schedule a meeting", or perform any Outlook/Microsoft 365 email or calendar operations. version: "1.1.0" license: MIT author: thecfguy tools: - bash capabilities: - Email Management (List, Read, Search, Send, Draft, Move, Delete, Folder Management) - Calendar Management (List, Create, Delete, Recurring Events) - Contacts Management (List, Search) tags: - productivity - communication - ms365 - email - calendar
Microsoft 365 Skill for OpenClaw
This skill empowers your OpenClaw agent to manage your Microsoft 365 Emails and Calendar directly from the terminal. It leverages the ms365 CLI tool to perform operations securely and efficiently.
Prerequisites
Before using this skill, ensure the ms365 CLI package is installed on the local system or available via npx.
# To install globally:
npm install -g ms365
Requirements:
Authentication Lifecycle
The agent cannot authenticate on behalf of the user. The user must manually run these commands beforehand or you can prompt the user to run them in an interactive terminal.
1. Configure Azure App credentials: ms365 auth configure --client-id
2. Login to Microsoft 365: ms365 auth login (Uses Device Code flow; user action required)
3. Check Auth Status: ms365 auth status
4. Logout: ms365 auth logout
Capabilities & Usage Instructions
You (the Agent) can use the bash tool to execute ms365 CLI commands to interact with the user's Microsoft 365 account. Below are the allowed operations.
π§ Email Operations
#### List Emails Use this to check recent messages or list items in a specific folder.
ms365 email list-c, --count : Number of results (default: 20)
- -f, --folder : Target folder - supports well-known names (inbox, sentitems, drafts, etc.), folder display names (case-insensitive), or folder IDs
- --select : Comma-separated fields (e.g., subject,from,bodyPreview)
- --list-folders: Show available folders instead of listing emails
- --all-folders: List emails from all folders at once
ms365 email list -c 5 -f inboxms365 email list --list-folders#### Read Email Fetches the full content of an email message given its ID.
ms365 email read ms365 email read AAMkADYzZ1...#### Search Emails Use Keyword Query Language (KQL) to find specific emails.
ms365 email search "" -c, --count : Result count limit
ms365 email search "from:boss@example.com subject:urgent" -c 10#### Send Email Compose and send an email directly without drafting it first.
ms365 email send [options]--to : Comma-separated recipient emails (Required)
- --subject "" : Email subject line
- --body "": The content of the email
- --cc, --bcc: Additional recipients
- --html: Treats the --body as HTML content
- --importance : Sets email priority
ms365 email send --to "jane@example.com" --subject "Meeting Notes" --body "Please find the notes attached."#### Draft Email Create an email that gets saved to the Drafts folder instead of sending immediately.
ms365 email draft [options]ms365 email draft --to "team@example.com" --subject "Weekly Update" --body "Draft content here"#### Move Email Move an email from one folder to another. Supports well-known folder names, custom folder display names, and folder IDs.
ms365 email move --list-folders: Show available folders before moving
can be a well-known folder name (inbox, drafts, sentitems, deleteditems, junkemail, archive, outbox), a folder display name (case-insensitive), or a folder ID.ms365 email move AAMkAD... archivems365 email move AAMkAD... "Archive 2024"#### Delete Email Moves an email to 'Deleted Items' or deletes it permanently.
ms365 email delete --permanent: Hard-deletes the email bypassing 'Deleted Items'.
ms365 email delete AAMkAD...#### List Folders List all available mail folders with metadata including unread counts and folder structure.
ms365 email folders list-c, --count : Max number of folders (default: 50)
- --select : Comma-separated fields
ms365 email folders list#### Folder Info Get detailed information about a specific folder by name or ID.
ms365 email folders info ms365 email folders info inbox#### Create Folder Create a new custom mail folder.
ms365 email folders create --parent : Parent folder ID for nested folders
ms365 email folders create "Archive 2024"π Calendar Operations
#### List Events Fetch upcoming calendar events.
ms365 calendar list-d, --days : Lookahead days limit (default is 7)
- --start , --end : ISO 8601 constraints (overrides days)
- -c, --count : Maximum entries to return
ms365 calendar list --days 3 -c 10#### Create Event Schedule a new meeting or blocker on the user's calendar.
ms365 calendar create [options]--subject "" : Event title
- --start : ISO 8601 string (e.g., 2024-07-01T09:00:00)
- --end : ISO 8601 string (e.g., 2024-07-01T10:00:00)
- --timezone : IANA timezone (default UTC, e.g., America/New_York)
- --attendees : Comma-separated addresses
- --body "" : Event details (--html can be used to treat body as HTML)
- --location "" : Physical or virtual location string
- --all-day: Flag to make this an all-day event
- --online-meeting: Automatically creates and attaches a Teams link
ms365 calendar create --subject "Sync" --start "2024-07-01T09:00:00" --end "2024-07-01T09:30:00" --attendees "bob@example.com" --online-meeting#### Delete Event Remove an event from the calendar.
ms365 calendar delete ms365 calendar delete AAMkADc...#### Create Recurring Event Schedule a recurring meeting or blocker on the user's calendar.
ms365 calendar series-create [options]--subject "" : Event title (Required)
- --start : ISO 8601 start time (Required)
- --end : ISO 8601 end time (Required)
- --pattern : Recurrence pattern (daily, weekly, absoluteMonthly, relativeMonthly, absoluteYearly, relativeYearly) (Required)
- --interval : Interval between occurrences (default: 1)
- --days-of-week : For weekly patterns (Mo,Tu,We,Th,Fr,Sa,Su)
- --range : How recurrence ends (endDate, noEnd, numbered) (default: noEnd)
- --end-date : End date for recurrence (Required if range is endDate)
- --occurrences : Number of occurrences (Required if range is numbered)
- --timezone : IANA timezone (default: UTC)
- --attendees : Comma-separated addresses
- --body "" : Event details
- --location "" : Physical or virtual location
- --all-day: Make this an all-day event
- --online-meeting: Automatically creates and attaches a Teams link
ms365 calendar series-create --subject "Daily Standup" --start "2024-07-10T09:00:00" --end "2024-07-10T09:30:00" --pattern daily --range numbered --occurrences 10#### Delete Recurring Event Remove a recurring event or individual occurrences from the series.
ms365 calendar series-delete --this-and-following: Delete this and following events in series
- --single: Delete only this single occurrence
ms365 calendar series-delete AAMkADc...π Contacts Operations
#### List Contacts Fetch contacts from your personal contacts folder.
ms365 contacts list-c, --count : Number of results (default: 50)
- --select : Comma-separated fields
ms365 contacts list --count 25#### Search Contacts Search contacts by name or email address.
ms365 contacts search "" -c, --count : Max results to return (default: 25)
ms365 contacts search "alice@example.com" --count 10--count responsibly. Do not request more than 100 items at once to avoid payload bloating.move or delete. You can retrieve IDs using the list or search commands.--timezone flag or use UTC natively.ms365 returns authentication errors like Token expired or Unauthorized, prompt the user to run ms365 auth login.βοΈ Configuration
Before using this skill, ensure the ms365 CLI package is installed on the local system or available via npx.
# To install globally:
npm install -g ms365
Requirements:
Authentication Lifecycle
The agent cannot authenticate on behalf of the user. The user must manually run these commands beforehand or you can prompt the user to run them in an interactive terminal.
1. Configure Azure App credentials: ms365 auth configure --client-id
2. Login to Microsoft 365: ms365 auth login (Uses Device Code flow; user action required)
3. Check Auth Status: ms365 auth status
4. Logout: ms365 auth logout