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:
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
# Mail
mog mail search "from:someone" --max 10
mog mail send --to a@b.com --subject "Hi" --body "Hello"
mog mail send --to a@b.com --subject "Report" --body-file report.md
mog mail send --to a@b.com --subject "Newsletter" --body-html "<h1>Hello</h1>"
cat draft.txt | mog mail send --to a@b.com --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 alice@example.com bob@example.com
# 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
1---2name: mog3description: Microsoft Ops Gadget — CLI for Microsoft 365 (Mail, Calendar, Drive, Contacts, Tasks, Word, PowerPoint, Excel, OneNote).4---5
6# mog — Microsoft Ops Gadget
7
8CLI for Microsoft 365: Mail, Calendar, OneDrive, Contacts, Tasks, Word, PowerPoint, Excel, OneNote.
9
10The Microsoft counterpart to `gog` (Google Ops Gadget). Same patterns, different cloud.
11
12## Quick Reference
13
14For comprehensive usage, run:
15```bash
16mog --ai-help
17```
18
19This outputs the full dashdash-compliant documentation including:
20- Setup/Prerequisites
21- All commands and options
22- Date/time formats
23- Examples (positive and negative)
24- Troubleshooting
25- Slug system explanation
26- gog compatibility notes
27
28## Modules
29
30| Module | Commands |
31|--------|----------|
32| **mail** | search, get, send, folders, drafts, attachment |
33| **calendar** | list, create, get, update, delete, calendars, respond, freebusy, acl |
34| **drive** | ls, search, download, upload, mkdir, move, rename, copy, rm |
35| **contacts** | list, search, get, create, update, delete, directory |
36| **tasks** | lists, list, add, done, undo, delete, clear |
37| **word** | list, export, copy |
38| **ppt** | list, export, copy |
39| **excel** | list, get, update, append, create, metadata, tables, add-sheet, clear, copy, export |
40| **onenote** | notebooks, sections, pages, get, create-notebook, create-section, create-page, delete, search |
41
42## Quick Start
43
44```bash
45# Mail
46mog mail search "from:someone" --max 10
47mog mail send --to a@b.com --subject "Hi" --body "Hello"
48mog mail send --to a@b.com --subject "Report" --body-file report.md
49mog mail send --to a@b.com --subject "Newsletter" --body-html "<h1>Hello</h1>"
50cat draft.txt | mog mail send --to a@b.com --subject "Hi" --body-file -
51
52# Calendar
53mog calendar list
54mog calendar create --summary "Meeting" --from 2025-01-15T10:00:00 --to 2025-01-15T11:00:00
55mog calendar freebusy alice@example.com bob@example.com
56
57# Drive
58mog drive ls
59mog drive upload ./file.pdf
60mog drive download <slug> --out ./file.pdf
61
62# Tasks
63mog tasks list
64mog tasks add "Buy milk" --due tomorrow
65mog tasks clear
66
67# Contacts
68mog contacts list
69mog contacts directory "john"
70
71# Excel
72mog excel list
73mog excel get <id> Sheet1 A1:D10
74mog excel update <id> Sheet1 A1:B2 val1 val2 val3 val4
75mog excel append <id> TableName col1 col2 col3
76
77# OneNote
78mog onenote notebooks
79mog onenote search "meeting notes"
80```
81
82## Slugs
83
84mog generates 8-character slugs for Microsoft's long GUIDs:
85- `a3f2c891` instead of `AQMkADAwATMzAGZmAS04MDViLTRiNzgt...`
86- All commands accept slugs or full IDs
87- Use `--verbose` to see full IDs
88
89## Aliases
90
91- `mog cal` → `mog calendar`
92- `mog todo` → `mog tasks`
93
94## Credential Storage
95
96OAuth tokens stored in config directory (0600 permissions):
97
98| Platform | Location |
99|----------|----------|
100| **macOS** | `~/.config/mog/` |
101| **Linux** | `~/.config/mog/` |
102| **Windows** | `%USERPROFILE%\.config\mog\` |
103
104Files:
105- `tokens.json` - OAuth tokens (encrypted at rest by OS)
106- `settings.json` - Client ID
107- `slugs.json` - Slug cache
108
109## See Also
110
111- `mog --ai-help` - Full documentation
112- `mog <command> --help` - Command-specific help