home / skills / openclaw / skills / mogcli

mogcli skill

/skills/visionik/mogcli

This skill helps you manage Microsoft 365 resources via a CLI, enabling mail, calendar, drive, contacts, tasks, and Office apps efficiently.

npx playbooks add skill openclaw/skills --skill mogcli

Review the files below or copy the command above to add this skill to your agents.

Files (38)
SKILL.md
3.1 KB
---
name: mog
description: Microsoft Ops Gadget — CLI for Microsoft 365 (Mail, Calendar, Drive, Contacts, Tasks, Word, PowerPoint, Excel, OneNote).
---

# mog — Microsoft Ops Gadget

CLI for Microsoft 365: Mail, Calendar, OneDrive, Contacts, Tasks, Word, PowerPoint, Excel, OneNote.

The Microsoft counterpart to `gog` (Google Ops Gadget). Same patterns, different cloud.

## Quick Reference

For comprehensive usage, run:
```bash
mog --ai-help
```

This outputs the full dashdash-compliant documentation including:
- Setup/Prerequisites
- All commands and options
- Date/time formats
- Examples (positive and negative)
- Troubleshooting
- Slug system explanation
- gog compatibility notes

## Modules

| Module | Commands |
|--------|----------|
| **mail** | search, get, send, folders, drafts, attachment |
| **calendar** | list, create, get, update, delete, calendars, respond, freebusy, acl |
| **drive** | ls, search, download, upload, mkdir, move, rename, copy, rm |
| **contacts** | list, search, get, create, update, delete, directory |
| **tasks** | lists, list, add, done, undo, delete, clear |
| **word** | list, export, copy |
| **ppt** | list, export, copy |
| **excel** | list, get, update, append, create, metadata, tables, add-sheet, clear, copy, export |
| **onenote** | notebooks, sections, pages, get, create-notebook, create-section, create-page, delete, search |

## Quick Start

```bash
# Mail
mog mail search "from:someone" --max 10
mog mail send --to [email protected] --subject "Hi" --body "Hello"
mog mail send --to [email protected] --subject "Report" --body-file report.md
mog mail send --to [email protected] --subject "Newsletter" --body-html "<h1>Hello</h1>"
cat draft.txt | mog mail send --to [email protected] --subject "Hi" --body-file -

# Calendar
mog calendar list
mog calendar create --summary "Meeting" --from 2025-01-15T10:00:00 --to 2025-01-15T11:00:00
mog calendar freebusy [email protected] [email protected]

# Drive
mog drive ls
mog drive upload ./file.pdf
mog drive download <slug> --out ./file.pdf

# Tasks
mog tasks list
mog tasks add "Buy milk" --due tomorrow
mog tasks clear

# Contacts
mog contacts list
mog contacts directory "john"

# Excel
mog excel list
mog excel get <id> Sheet1 A1:D10
mog excel update <id> Sheet1 A1:B2 val1 val2 val3 val4
mog excel append <id> TableName col1 col2 col3

# OneNote
mog onenote notebooks
mog onenote search "meeting notes"
```

## Slugs

mog generates 8-character slugs for Microsoft's long GUIDs:
- `a3f2c891` instead of `AQMkADAwATMzAGZmAS04MDViLTRiNzgt...`
- All commands accept slugs or full IDs
- Use `--verbose` to see full IDs

## Aliases

- `mog cal` → `mog calendar`
- `mog todo` → `mog tasks`

## Credential Storage

OAuth tokens stored in config directory (0600 permissions):

| Platform | Location |
|----------|----------|
| **macOS** | `~/.config/mog/` |
| **Linux** | `~/.config/mog/` |
| **Windows** | `%USERPROFILE%\.config\mog\` |

Files:
- `tokens.json` - OAuth tokens (encrypted at rest by OS)
- `settings.json` - Client ID
- `slugs.json` - Slug cache

## See Also

- `mog --ai-help` - Full documentation
- `mog <command> --help` - Command-specific help

Overview

This skill is a CLI tool for Microsoft 365 that lets you manage Mail, Calendar, OneDrive, Contacts, Tasks, Word, PowerPoint, Excel, and OneNote from the terminal. It mirrors the patterns of a Google counterpart so users familiar with that workflow can adopt it quickly. It focuses on scripted automation, quick lookups, and interoperable slugs for long GUIDs.

How this skill works

The CLI exposes modules for each Microsoft 365 surface with commands for common operations (search, get, create, update, delete, export, etc.). It accepts short 8-character slugs or full IDs, stores OAuth tokens and settings in a per-user config directory, and integrates shell-friendly I/O (files, stdin, stdout) for automation. Run mog --ai-help or mog <command> --help for complete usage, formats, and examples.

When to use it

  • Automating mailbox searches, sends, drafts, and attachment handling from scripts.
  • Scheduling or querying calendar events, free/busy checks, and programmatic event creation.
  • Managing OneDrive files: list, upload, download, move, and batch operations in CI or backups.
  • Interacting with Excel, Word, PowerPoint and OneNote for exports, sheet updates, and content extraction.
  • Syncing, backing up, or searching contacts and tasks as part of maintenance jobs.

Best practices

  • Use slugs for human-friendly IDs in scripts and add --verbose when debugging to reveal full GUIDs.
  • Keep credentials protected: config files are user-owned with restricted permissions; use OS encryption where available.
  • Pipe data via stdin/stdout or body-file for reproducible sends and automation (eg. cat report.md | mog mail send ...).
  • Test commands with --dry-run or smaller datasets before bulk operations like rm, delete, or clear.
  • Consult mog <command> --help for command-specific flags, date/time formats, and examples to avoid malformed requests.

Example use cases

  • Add a recurring calendar event and notify participants from a deployment script.
  • Batch-download attachments from matching emails and store them in a backup location.
  • Upload build artifacts to OneDrive and publish links in a Teams-ready email.
  • Append rows to an Excel table from a CSV export during nightly ETL.
  • Search OneNote for meeting notes containing a client name and export pages to markdown.

FAQ

Can I use short slugs everywhere?

Yes. The CLI accepts 8-character slugs or full IDs; slugs are generated and cached for convenience. Use --verbose to display full IDs.

Where are my OAuth tokens stored and are they secure?

Tokens and settings live in your per-user config directory (~/.config/mog/ on macOS/Linux, %USERPROFILE%\.config\mog on Windows). Files are stored with restricted permissions; OS-level encryption applies when available.