Install
openclaw skills install outlook-email-skill-fixedMicrosoft Outlook/Live.com email and calendar client via Microsoft Graph API. List, search, read, send emails. View and create calendar events. Supports device code auth for servers.
openclaw skills install outlook-email-skill-fixedCommand-line email and calendar client for Microsoft Outlook/Live/Hotmail using Microsoft Graph API.
Version: 2.0
Features:
Required Tools:
Bash: Execute Python CLI scriptRead: Read token and configuration filesWrite: Store OAuth tokens and settingsNetwork Access:
graph.microsoft.com)requests library for HTTP communicationsData Storage:
~/.config/outlook-cli/token.json (requires file permission 600)Python Dependencies:
requests library⚠️ 安全提示:
- 请仅从官方 Microsoft Azure 门户 (https://portal.azure.com) 创建应用并获取凭据
- 切勿使用来自非官方渠道、第三方网站或他人分享的凭据
- Client ID 和 Tenant ID 可以公开,但 Client Secret 必须保密
- 定期审查和轮换凭据以提高安全性
- 仅授予必需的最小权限(遵循最小权限原则)
Create Azure AD App: https://portal.azure.com → App registrations
outlook-clihttp://localhost:8080/callbackAdd API permissions (Microsoft Graph, Delegated):
Mail.Read, Mail.ReadWrite, Mail.SendCalendars.Read, Calendars.ReadWriteUser.Read, offline_accessGet credentials from your app registration
Configure:
outlook configure
Authenticate:
# For local environment with browser
outlook auth
# For servers/headless environments (recommended)
outlook auth --device-code
Secure token file (Critical!):
# Set restrictive permissions
chmod 600 ~/.config/outlook-cli/token.json
# Verify (should show: -rw-------)
ls -l ~/.config/outlook-cli/token.json
⚠️ Important: Never commit this file to version control or share it with others!
| Command | Description |
|---|---|
outlook list [n] | List recent emails |
outlook search "query" [n] | Search emails |
outlook read <id> | Read email by ID |
outlook send --to ... | Send email |
outlook reply <id> | Reply to email |
outlook status | Check auth status |
| Command | Description |
|---|---|
outlook calendar list [--days N] | List upcoming events |
outlook calendar create ... | Create calendar event |
List emails:
outlook list 20
返回格式示例:
│ 序号 │ 发件人 │ 主题 │ 日期 │ 状态 │
├──────┼────────────────────────────┼───────────────────────────────┼──────────────────┼────────┤
│ 1 │ user@example.com │ 项目进展汇报 │ 2026-03-19 10:30 │ 未读 │
│ 2 │ admin@company.com │ 周会通知 │ 2026-03-19 09:15 │ ✓ 已读 │
│ 3 │ noreply@service.com │ 账户安全提醒 │ 2026-03-18 18:20 │ 未读 │
Search:
outlook search "from:linkedin.com"
outlook search "subject:invoice"
outlook search "hasattachment:yes"
Send:
outlook send --to "user@example.com" --subject "Hello" --body "Message"
outlook send --to "a@x.com,b@x.com" --cc "boss@x.com" --subject "Update" --body-file ./msg.txt
Reply:
outlook reply EMAIL_ID --body "Thanks!"
outlook reply EMAIL_ID --all --body "Thanks everyone!"
View events:
# Next 7 days (default)
outlook calendar list
# Next 14 days
outlook calendar list --days 14
Create event:
# Simple event
outlook calendar create \
--subject "Team Meeting" \
--date "2026-03-20" \
--time "14:00" \
--duration 60
# With attendees and location
outlook calendar create \
--subject "Project Review" \
--date "2026-03-21" \
--time "10:00" \
--duration 90 \
--attendees "user1@example.com,user2@example.com" \
--location "Conference Room A"
Browser auth (local environment):
outlook auth
Device code auth (servers/headless):
outlook auth --device-code
# Visit https://microsoft.com/devicelogin
# Enter the displayed code
from:email@domain.com - Senderto:email@domain.com - Recipientsubject:keyword - Subject linebody:keyword - Email bodyreceived:YYYY-MM-DD - Datehasattachment:yes - Has attachmentsSKILL.md - This documentationoutlook - Main CLI script (Python)README.md - Full documentationToken storage location: ~/.config/outlook-cli/token.json
🔐 Security Warning - Token File Protection:
- This file contains sensitive OAuth tokens that grant access to your email and calendar
- NEVER share, commit to version control, or expose this file publicly
- Set restrictive file permissions immediately after first authentication:
chmod 600 ~/.config/outlook-cli/token.json- Verify permissions:
ls -l ~/.config/outlook-cli/token.jsonshould show-rw-------- Add to
.gitignoreif working in a git repository:echo ".config/outlook-cli/token.json" >> ~/.gitignore- If the token file is accidentally exposed, immediately revoke access at: https://account.microsoft.com/privacy/app-access → Remove outlook-cli app
Token features:
When re-authentication is required:
| Scenario | Reason |
|---|---|
| Changed Microsoft password | Refresh token immediately invalidated |
| Token expired (>90 days) | Microsoft refresh token has limited lifetime |
| Manually revoked access | App permissions revoked in Microsoft account settings |
| Token file deleted | File loss requires re-authentication |
Re-authentication:
outlook auth --device-code
# Visit https://login.microsoft.com/device
# Enter the displayed code
A: Run outlook auth --device-code to re-authenticate.
A: Immediate action required:
rm ~/.config/outlook-cli/token.jsonoutlook auth --device-codechmod 600 ~/.config/outlook-cli/token.jsongit filter-branch or BFG Repo-CleanerA: Use Microsoft Graph API's recurrence field, or create via Outlook web interface.
A: Microsoft Graph API has daily limits. Wait 1-2 hours and retry.