Microsoft Outlook CLI
for cmdhub.
Outlook mail folders, messages, drafts, and attachments through Microsoft Graph.
cmdhub get msoutlook
data_object Agent Contract
Agents should start with auth/status and discovery commands, inspect schemas before composition, and treat commands marked as mutating as state-changing operations.
Output
Use human output for normal reads, `--json` for scripting or complete structured fields, and `--jsonl` for upstream pipe inputs.
Auth
Microsoft OAuth. Used for Outlook messages, drafts, attachments, and mail sending.
Refs
Prefer list/search, then short refs or piped JSONL. Use `resolve` to inspect cached refs.
Schemas
Use `msoutlook schema` and `catalog.json` to inspect fields, flags, examples, and side effects.
Auth scopes
offline_accessUser.ReadMail.ReadWriteMail.SendOptional scope bundles
With msoutlook auth login --mailbox-settings
MailboxSettings.ReadMailboxSettings.ReadWriteWith msoutlook auth login --shared
Mail.ReadWrite.SharedMail.Send.Sharedterminal Command Reference
Generated from source. Global flags apply to all commands.
Global Flags
--json
bool
Emit JSON machine output--jsonl
bool
Emit JSONL records for piping--output, -o
string
Compatibility output mode: json|jsonl. Prefer --json or --jsonl--view
string = summary
View mode: summary|full--profile
string = default
Config/auth profile--config
string
Config path override--quiet, -q
bool
Suppress non-essential diagnostics--debug
bool
Enable debug diagnostics--limit
int = 50
Maximum items to emit--page-size
int = 50
Requested upstream page size--cursor
string
Continuation cursor--no-paginate
bool
Fetch only one page--version, -v
bool
Print version information--mailbox
string
Shared or delegated mailbox email/UPN to target for this commandmsoutlook attachment
Work with Outlook message attachmentsmsoutlook attachment create
Add a file attachment to a draft message--file
string
File path to attach--message
string
Message or draft ref/IDmsoutlook attachment delete
Delete an attachment from a draft or message--all
bool
Confirm batch attachment delete--dry-run
bool
Preview attachment deletion without deleting--message
string
Message ref or ID when attachment is not a local ref--yes
bool
Confirm attachment deletionmsoutlook attachment download
Download an attachment to a file--message
string
Message ref or ID when attachment is not a local ref--output-file
string
Write decoded attachment bytes to this pathmsoutlook attachment get
Get an attachment--emit-content
bool
Include base64 content in JSON output--message
string
Message ref or ID when attachment is not a local ref--output-file
string
Write decoded attachment bytes to this pathmsoutlook attachment list
List message attachments--message
string
Message ref or IDmsoutlook auth
Manage Microsoft authenticationmsoutlook auth login
Authenticate with Microsoft OutlookAuthenticate with Microsoft device-code OAuth for Microsoft Graph Outlook mail.
This stores a Microsoft OAuth grant in the shared cmdhub credential backend. Use a Microsoft account browser sign-in and consent prompt; do not enter a normal account password in this CLI. The default packaged public client requests delegated Outlook scopes and refresh-token consent.
--shared
bool
Request delegated shared-mailbox read/write and send scopesmsoutlook auth logout
Remove stored Microsoft credentialsRemove the stored Microsoft OAuth grant for the selected msoutlook profile.
This deletes the local access token, refresh token, and Microsoft identity metadata from the shared credential backend. It does not revoke consent in Microsoft Entra.
msoutlook auth refresh
Refresh stored tokenRefresh the stored Microsoft OAuth grant through the shared credential backend.
Use –shared when refreshing a profile that was granted delegated shared-mailbox scope.
--shared
bool
Refresh a token that includes delegated shared-mailbox read/write and send scopesmsoutlook auth status
Show auth statusShow the stored Microsoft OAuth grant status for the selected msoutlook profile.
The status names the credential backend, Microsoft account identity, required Microsoft Graph scopes, missing scopes, token validity, and the exact login command to recover.
--shared
bool
Check delegated shared-mailbox read/write and send scopesmsoutlook auth whoami
Show current Microsoft identitymsoutlook capabilities
Describe capabilities--section
string
Show one capability section: scopes, schemas, or commandsmsoutlook config
Inspect local configurationmsoutlook config explain
Explain resolved configurationmsoutlook conversation
Work with Outlook message conversationsmsoutlook conversation archive
Archive every message in a conversation--all
bool
Apply the action to every message in the conversation--yes
bool
Confirm the conversation mutationmsoutlook conversation delete
Delete every message in a conversation--all
bool
Apply the action to every message in the conversation--dry-run
bool
Preview conversation message deletion without deleting--yes
bool
Confirm the conversation mutationmsoutlook conversation get
Get a conversationmsoutlook conversation list
List conversations--folder
string
Folder ref, ID, or well-known name such as inbox--query
string
Search text or Graph-style fielded terms--unread
bool
Only show conversations with unread messagesmsoutlook conversation move
Move every message in a conversation--all
bool
Apply the action to every message in the conversation--folder
string
Destination folder ref, ID, or well-known name--yes
bool
Confirm the conversation mutationmsoutlook conversation read
Mark every message in a conversation read--all
bool
Apply the action to every message in the conversation--yes
bool
Confirm the conversation mutationmsoutlook conversation search
Search conversations--folder
string
Folder ref, ID, or well-known name such as inbox--query
string
Search text or Graph-style fielded terms--unread
bool
Only show conversations with unread messagesmsoutlook conversation unread
Mark every message in a conversation unread--all
bool
Apply the action to every message in the conversation--yes
bool
Confirm the conversation mutationmsoutlook doctor
Run msoutlook diagnosticsmsoutlook draft
Work with Outlook draftsmsoutlook draft create
Create a draft--attach
stringSlice = []
File path(s) to attach--bcc
stringSlice = []
Bcc recipient; repeat or comma-separate--body
string
Message body--body-file
string
Read message body from file--category
stringSlice = []
Category name/ref; repeat or comma-separate--cc
stringSlice = []
Cc recipient; repeat or comma-separate--content-type
string
Body content type: text or html--importance
string
Importance: low, normal, or high--subject
string
Message subject--to
stringSlice = []
Recipient; repeat or comma-separatemsoutlook draft delete
Delete a draft--all
bool
Confirm batch draft delete--dry-run
bool
Preview draft deletion without deleting--yes
bool
Confirm destructive batch draft deletemsoutlook draft get
Get a draftmsoutlook draft list
List draft messages--query
string
Filter drafts locallymsoutlook draft search
Search draft messages--query
string
Filter drafts locallymsoutlook draft send
Send a draftmsoutlook draft update
Update a draft--attach
stringSlice = []
File path(s) to add as attachments--bcc
stringSlice = []
Bcc recipient; repeat or comma-separate--body
string
New body--body-file
string
Read new body from file--category
stringSlice = []
Category name/ref; repeat or comma-separate--cc
stringSlice = []
Cc recipient; repeat or comma-separate--content-type
string
Body content type: text or html--importance
string
Importance: low, normal, or high--subject
string
New subject--to
stringSlice = []
Recipient; repeat or comma-separatemsoutlook folder
Work with Outlook mail foldersmsoutlook folder create
Create a mail folder--name
string
Folder display name--parent
string
Parent folder ref, ID, or well-known namemsoutlook folder delete
Delete an ordinary mail folder--dry-run
bool
Preview recursive folder deletion without changing the mailbox--recursive
bool
Allow deleting a folder that contains messages or child folders--yes
bool
Confirm folder deletionmsoutlook folder get
Get a mail foldermsoutlook folder list
List mail folders--query
string
Filter folder names locallymsoutlook folder move
Move a mail folder under another folder--parent
string
Destination parent folder ref, ID, or well-known namemsoutlook folder search
Search mail folders--query
string
Filter folder names locallymsoutlook folder update
Rename a mail folder--name
string
New folder display namemsoutlook mailbox
Inspect the selected Outlook mailboxmsoutlook mailbox get
Get selected mailbox metadatamsoutlook mcp
Run the MCP serverRun a stdio Model Context Protocol server for this adapter.
The server exposes read-only resource commands by default. Mutating commands are listed only when explicitly allowed with –allow and remain gated by the command contract safety class.
--allow
stringArray = []
Allow mutating command keys such as gmail.message.archive or gmail.message.label.*--allow-dangerous
bool
Allow --allow wildcards to include destructive or sends_external commands--concurrency
int
Maximum concurrent MCP subprocesses--max-output
int64 = 0
Maximum stdout/stderr bytes captured per MCP command--print-config
bool
Print MCP tool configuration and exit--timeout
duration = 0s
Per-command MCP subprocess timeout, for example 45s or 2mmsoutlook message
Work with Outlook messagesmsoutlook message archive
Move a message to archive--all
bool
Confirm batch message mutationmsoutlook message categorize
Add a category to a message--category
string
Category ref, name, or IDmsoutlook message copy
Copy a message to another folder--folder
string
Destination folder ref, ID, or well-known namemsoutlook message create
Create or send a message--attach
stringSlice = []
File path(s) to attach--bcc
stringSlice = []
Bcc recipient; repeat or comma-separate--body
string
Message body--body-file
string
Read message body from file--category
stringSlice = []
Category name/ref; repeat or comma-separate--cc
stringSlice = []
Cc recipient; repeat or comma-separate--content-type
string
Body content type: text or html--draft
bool
Save as draft instead of sending--importance
string
Importance: low, normal, or high--subject
string
Message subject--to
stringSlice = []
Recipient; repeat or comma-separatemsoutlook message delete
Delete a message--all
bool
Confirm batch message delete--dry-run
bool
Preview message deletion without deleting--yes
bool
Confirm destructive batch message deletemsoutlook message forward
Forward a message--body
string
Forward comment--draft
bool
Create a forward draft instead of sending--to
stringSlice = []
Forward recipient; repeat or comma-separatemsoutlook message get
Get a messagemsoutlook message list
List messages--before
string
Only messages received before this date/time--category
string
Category name or ref to match--folder
string
Folder ref, ID, or well-known name such as inbox--from
string
Sender email, display name, or Graph sender token--graph-search
bool
Send --query and typed search terms to Microsoft Graph $search--has-attachments
bool
Only messages with attachments--query
string
Filter messages by subject, sender, recipient, or preview--since
string
Only messages received on or after this date/time--to
string
Recipient email, display name, or Graph recipient token--unread
bool
Only show unread messagesmsoutlook message move
Move a message to another folder--folder
string
Destination folder ref, ID, or well-known namemsoutlook message read
Mark a message read--all
bool
Confirm batch message mutationmsoutlook message reply
Reply to a message--body
string
Reply body--draft
bool
Create a reply draft instead of sendingmsoutlook message reply-all
Reply all to a message--body
string
Reply-all body--draft
bool
Create a reply-all draft instead of sendingmsoutlook message restore
Restore a deleted message to a folder--folder
string
Destination restore foldermsoutlook message search
Search messages--before
string
Only messages received before this date/time--category
string
Category name or ref to match--folder
string
Folder ref, ID, or well-known name such as inbox--from
string
Sender email, display name, or Graph sender token--graph-search
bool
Send --query and typed search terms to Microsoft Graph $search--has-attachments
bool
Only messages with attachments--query
string
Search text over subject, sender, recipients, or body preview--since
string
Only messages received on or after this date/time--to
string
Recipient email, display name, or Graph recipient token--unread
bool
Only show unread messagesmsoutlook message send
Send a draft or one explicit message--attach
stringSlice = []
File path(s) to attach--bcc
stringSlice = []
Bcc recipient; repeat or comma-separate--body
string
Message body--body-file
string
Read message body from file--category
stringSlice = []
Category name/ref; repeat or comma-separate--cc
stringSlice = []
Cc recipient; repeat or comma-separate--content-type
string
Body content type: text or html--importance
string
Importance: low, normal, or high--subject
string
Message subject--to
stringSlice = []
Recipient; repeat or comma-separatemsoutlook message uncategorize
Remove a category from a message--category
string
Category ref, name, or IDmsoutlook message unread
Mark a message unread--all
bool
Confirm batch message mutationmsoutlook message update
Update a message or draft--attach
stringSlice = []
File path(s) to add as attachments--bcc
stringSlice = []
Bcc recipient; repeat or comma-separate--body
string
New body--body-file
string
Read new body from file--category
stringSlice = []
Category name/ref; repeat or comma-separate--cc
stringSlice = []
Cc recipient; repeat or comma-separate--content-type
string
Body content type: text or html--importance
string
Importance: low, normal, or high--subject
string
New subject--to
stringSlice = []
Recipient; repeat or comma-separatemsoutlook profile
Manage provider profilesmsoutlook profile create
Create an unauthenticated provider profilemsoutlook profile delete
Delete a local provider profilemsoutlook profile list
List provider profilesmsoutlook profile rename
Rename a local provider profilemsoutlook profile use
Set the default provider profilemsoutlook resolve
Resolve a local msoutlook referencemsoutlook schema
Emit msoutlook schema hintsShow schema hints for Outlook resource payloads emitted or accepted by this CLI.
Use this when you need to understand structured output fields for automation or downstream parsing.
--in
bool
Show input schema--input
bool
Show input schema--out
bool
Show output schema--schema-output
bool
Show output schemamsoutlook version
Print version informationplay_circle Live Examples
Output captured from a real workspace. Regenerate with
scripts/gen-docs.sh --update.
auth
Not logged in. Next steps: - Login: msoutlook auth login
msoutlook doctor: FAIL Checks: credential_backend ok, credential_security warn, profiles warn, microsoft_oauth ok, token fail CHECK STATUS DETAIL credential_backend OK using file credential_security WARN credential backend stores local plaintext secrets profiles WARN no provider profiles configured microsoft_oauth OK Microsoft Outlook OAuth client is configured token FAIL no stored Microsoft token Next steps: - Status: msoutlook auth login - Capabilities: msoutlook capabilities
schemas
Schema: msoutlook.message.create.input.v1 (msoutlook message create input) Required: to, subject Optional: cc, bcc, body, importance, attach, draft
overview
msoutlook capabilities Resources: attachment, auth, automatic-reply, capabilities, category, config, conversation, doctor, draft, folder, mailbox, mailbox-settings, message, profile, resolve, rule, schema, version Machine output: --json, --jsonl Required scopes: Mail.ReadWrite, Mail.Send, User.Read, offline_access Next steps: - Scopes: msoutlook capabilities --section scopes - Schema: msoutlook schema - Contract: msoutlook capabilities --json - Help: msoutlook --help
alt_route Composition Patterns
Bridge your ecosystem with zero middleware.
msoutlook auth login
# Read Outlook mail
msoutlook folder list
msoutlook message list --folder inbox --limit 10
msoutlook message get m1
msoutlook resolve u1
# Create and send mail
msoutlook message create --to alice@example.com --subject "Status" --body "Sent now"
msoutlook message create --to alice@example.com --subject "Status" --body "Attached" --attach ./status.txt
msoutlook message create --to alice@example.com --subject "Status" --body "Save first" --draft
msoutlook draft update d1 --attach ./status.txt
msoutlook draft send d1
msoutlook attachment list m1
msoutlook attachment get a1 --emit-content --json
# Pipe one listed message into a follow-up command
msoutlook message list --folder inbox --limit 1 --jsonl | msoutlook message get