Purpose
Fetch calendar events from Microsoft Exchange Web Services (EWS) and return them as structured JSON.
When to Use
- - User asks about their calendar events ("What's on my calendar today?")
- Need to retrieve meetings for today, tomorrow, or a specific date
- Extracting meeting details: subject, time, location, organizer, body text, links
Security Model
Credentials are stored in OS keyring, NOT in config files:
- - macOS: Keychain Access (encrypted, OS-managed)
- Linux: libsecret / gnome-keyring (encrypted, OS-managed)
Only EWS_URL and EWS_USER are stored in OpenClaw config (non-secret). The password is retrieved securely at runtime.
Setup
1. Install keyring tools (Linux only)
CODEBLOCK0
macOS has Keychain built-in.
2. Store credentials in keyring
CODEBLOCK1
You will be prompted for your password. This stores it securely in the OS keyring.
3. Configure OpenClaw
Add to ~/.openclaw/openclaw.json:
CODEBLOCK2
Replace with your actual Exchange URL and username.
Usage
The skill runs {baseDir}/ews-calendar-secure.sh which:
- 1. Retrieves
EWS_PASS from OS keyring - Calls the main script with all credentials in environment
- Returns JSON output
Command Syntax
CODEBLOCK3
Parameters
- -
--date (required): Date filter
-
YYYY-MM-DD — specific date (e.g.,
2026-03-03)
-
today — today's date
-
tomorrow — tomorrow's date
- -
--output <FILE>: Write JSON to file instead of stdout - INLINECODE11 : Enable debug logging
- INLINECODE12 : Save raw XML response for debugging
Output Format
Returns JSON array of calendar events:
CODEBLOCK4
Returns empty array [] if no events found.
Example Invocations
Get today's events:
CODEBLOCK5
Get tomorrow's events to file:
CODEBLOCK6
Get specific date with debug:
CODEBLOCK7
Troubleshooting
Password not found in keyring
CODEBLOCK8
Solution: Run the setup script to store your password:
CODEBLOCK9
Linux: secret-tool not found
CODEBLOCK10
Solution: Install libsecret tools:
CODEBLOCK11
Linux: Keyring locked
On Linux, the keyring may be locked after login.
Solution: Unlock your keyring (usually happens automatically on desktop login). For headless servers, you may need to set up a keyring daemon.
HTTP request failed
CODEBLOCK12
Possible causes:
- - Incorrect username or password
- Password changed — re-run setup script
- Account locked or expired
SOAP Fault
CODEBLOCK13
Possible causes:
- - Invalid EWS URL (check
EWS_URL in config) - Date format issue (use
YYYY-MM-DD) - Exchange server configuration issue
Credential Management
Update password (after password change)
CODEBLOCK14
The script will overwrite the existing entry.
Remove credentials
CODEBLOCK15
Or manually:
macOS:
CODEBLOCK16
Linux:
CODEBLOCK17
View stored credentials (macOS only)
CODEBLOCK18
Files in This Skill
CODEBLOCK19
Alternative: Standalone Usage (without keyring)
For development or testing, you can run ews-calendar.sh directly with a .env file:
- 1. Copy
.env.example to INLINECODE19 - Fill in your credentials
- Run: INLINECODE20
Warning: This stores password in plaintext. Use keyring for production.
目的
从Microsoft Exchange Web Services (EWS)获取日历事件,并以结构化JSON格式返回。
使用场景
- - 用户询问日历事件(我今天有什么日程?)
- 需要获取今天、明天或特定日期的会议安排
- 提取会议详情:主题、时间、地点、组织者、正文内容、链接
安全模型
凭据存储在操作系统密钥环中,而非配置文件中:
- - macOS:钥匙串访问(加密,由操作系统管理)
- Linux:libsecret / gnome-keyring(加密,由操作系统管理)
只有EWSURL和EWSUSER存储在OpenClaw配置中(非机密信息)。密码在运行时安全获取。
设置
1. 安装密钥环工具(仅限Linux)
bash
Debian/Ubuntu
sudo apt install libsecret-tools gnome-keyring
Fedora
sudo dnf install libsecret gnome-keyring
Arch
sudo pacman -S libsecret gnome-keyring
macOS自带钥匙串功能。
2. 在密钥环中存储凭据
bash
{baseDir}/ews-calendar-setup.sh --user DOMAIN\\username
系统会提示输入密码。此操作将密码安全存储在操作系统密钥环中。
3. 配置OpenClaw
添加到~/.openclaw/openclaw.json:
json5
{
skills: {
entries: {
ews-calendar: {
enabled: true,
env: {
EWS_URL: https://outlook.company.com/EWS/Exchange.asmx,
EWS_USER: DOMAIN\\username
}
}
}
}
}
请替换为实际的Exchange URL和用户名。
使用方法
该技能运行{baseDir}/ews-calendar-secure.sh,执行以下操作:
- 1. 从操作系统密钥环获取EWS_PASS
- 在环境中携带所有凭据调用主脚本
- 返回JSON输出
命令语法
bash
{baseDir}/ews-calendar-secure.sh --date [--output ] [--verbose]
参数
- YYYY-MM-DD — 特定日期(例如:2026-03-03)
- today — 今天的日期
- tomorrow — 明天的日期
- - --output :将JSON写入文件而非标准输出
- --verbose:启用调试日志
- --debug-xml :保存原始XML响应以进行调试
输出格式
返回日历事件的JSON数组:
json
[
{
subject: 团队站会,
start: 2026-03-03T10:00:00Z,
end: 2026-03-03T10:30:00Z,
location: A会议室,
organizer: manager@company.com,
body: 每周同步会议,讨论冲刺进度...,
links: [https://zoom.us/j/12345, https://confluence.example.com/doc]
}
]
如果未找到事件,则返回空数组[]。
调用示例
获取今天的事件:
bash
{baseDir}/ews-calendar-secure.sh --date today
获取明天的事件并保存到文件:
bash
{baseDir}/ews-calendar-secure.sh --date tomorrow --output /tmp/tomorrow.json
获取特定日期并启用调试:
bash
{baseDir}/ews-calendar-secure.sh --date 2026-03-03 --verbose --debug-xml /tmp/debug.xml
故障排除
密钥环中未找到密码
[ERROR] 未找到用户 DOMAIN\username 的密码
[HINT] 运行:./ews-calendar-setup.sh 以存储凭据
解决方案: 运行设置脚本存储密码:
bash
{baseDir}/ews-calendar-setup.sh --user DOMAIN\\username
Linux:未找到secret-tool
[ERROR] 未找到 secret-tool。请安装:apt install libsecret-tools
解决方案: 安装libsecret工具:
bash
sudo apt install libsecret-tools gnome-keyring
Linux:密钥环已锁定
在Linux上,登录后密钥环可能处于锁定状态。
解决方案: 解锁密钥环(通常在桌面登录时自动完成)。对于无头服务器,可能需要设置密钥环守护进程。
HTTP请求失败
[ERROR] HTTP请求失败,状态码:401
可能原因:
- - 用户名或密码错误
- 密码已更改——重新运行设置脚本
- 账户被锁定或已过期
SOAP错误
[ERROR] 检测到SOAP错误
错误代码:a:ErrorInvalidRequest
错误信息:请求无效。
可能原因:
- - EWS URL无效(检查配置中的EWS_URL)
- 日期格式问题(使用YYYY-MM-DD格式)
- Exchange服务器配置问题
凭据管理
更新密码(密码更改后)
bash
{baseDir}/ews-calendar-setup.sh --user DOMAIN\\username
该脚本将覆盖现有条目。
删除凭据
bash
{baseDir}/ews-calendar-setup.sh --user DOMAIN\\username --delete
或手动操作:
macOS:
bash
security delete-generic-password -a DOMAIN\\username -s ews-calendar
Linux:
bash
secret-tool clear service ews-calendar user DOMAIN\\username
查看已存储的凭据(仅限macOS)
bash
security find-generic-password -a DOMAIN\\username -s ews-calendar -w
本技能包含的文件
{baseDir}/
├── SKILL.md # 本文件
├── ews-calendar.sh # 主脚本(从环境变量或.env文件读取)
├── ews-calendar-secure.sh # 从密钥环获取密码的包装脚本
├── ews-calendar-setup.sh # 在密钥环中存储凭据
├── templates/
│ ├── find-items.xml # 查找日历项目的SOAP模板
│ └── get-item.xml # 获取项目详情的SOAP模板
└── .env.example # 独立使用的示例配置
替代方案:独立使用(无需密钥环)
用于开发或测试,可以直接使用.env文件运行ews-calendar.sh:
- 1. 将.env.example复制为.env
- 填写凭据
- 运行:./ews-calendar.sh --date today
警告: 此方式以明文存储密码。生产环境请使用密钥环。