Microsoft 365 CLI focused on Microsoft Graph (SharePoint/OneDrive, Teams, Exchange/Outlook, OneNote, Excel, Microsoft Search, Intune).
- Create an Entra ID app registration for a public client.
- Grant delegated permissions you plan to use (e.g.,
User.Read, Mail.ReadWrite, Calendars.ReadWrite, Sites.ReadWrite.All, ChannelMessage.Send).
- Login:
msm auth login --client-id <CLIENT_ID> --tenant <TENANT_ID> \
--scope User.Read --scope Mail.ReadWrite --scope Calendars.ReadWrite \
--scope Sites.ReadWrite.All --scope ChannelMessage.Send
- Call Graph:
msm graph get /me
msm graph get /me/messages
| Flag |
Description |
Default |
--profile |
Profile name |
default |
--output |
Output format (json or plain) |
json |
--beta |
Use Graph beta endpoint |
false |
--api-base |
Override Graph base URL |
empty |
| Command |
Description |
msm auth login --tenant --client-id [--scope ...] [--save-profile] |
Device code login and save profile |
msm auth status |
Show profile and token status |
msm auth profiles |
List configured profiles |
msm auth logout |
Delete cached tokens |
| Command |
Description |
msm graph get <path> |
Raw GET |
msm graph post <path> --body |
Raw POST |
msm graph patch <path> --body |
Raw PATCH |
msm graph delete <path> |
Raw DELETE |
msm graph request <method> <path> [--body] [--content-type] |
Raw request |
| Command |
Description |
msm onedrive drives list |
List drives for signed-in user |
msm onedrive drive get --drive-id |
Get a drive |
msm onedrive item get --drive-id --item-id |
Get a drive item |
msm onedrive item list --drive-id --item-id |
List child items |
msm onedrive item list-root --drive-id |
List root items |
msm onedrive item upload --drive-id --parent-id --name --file |
Upload/replace small file (<=250MB) |
msm onedrive item upload-large --drive-id --parent-id --name --file |
Upload large file via upload session |
msm onedrive item download --drive-id --item-id --out |
Download a file |
msm onedrive item delete --drive-id --item-id |
Delete item |
msm onedrive item mkdir --drive-id --parent-id --name |
Create folder |
msm onedrive item share-link --drive-id --item-id --type --scope |
Create sharing link |
msm onedrive item invite --drive-id --item-id --recipients --roles |
Invite users to item |
| Command |
Description |
msm sharepoint site get --site-id |
Get site by ID |
msm sharepoint site get-by-path --hostname --path |
Get site by hostname and path |
msm sharepoint site list-subsites --site-id |
List subsites |
msm sharepoint list list --site-id |
List lists |
msm sharepoint list get --site-id --list-id |
Get list |
msm sharepoint list item list --site-id --list-id |
List list items |
msm sharepoint list item get --site-id --list-id --item-id |
Get list item |
msm sharepoint list item create --site-id --list-id --fields |
Create list item |
msm sharepoint list item update --site-id --list-id --item-id --fields |
Update list item |
msm sharepoint drive list --site-id |
List document libraries |
msm sharepoint drive get-default --site-id |
Get default document library |
| Command |
Description |
msm onenote notebook list |
List notebooks |
msm onenote section list --notebook-id |
List sections |
msm onenote page list --section-id |
List pages |
msm onenote page create --section-id --file |
Create page (HTML body) |
msm onenote page get-content --page-id --out |
Get page content |
msm onenote page update --page-id --file |
Update page content |
| Command |
Description |
msm excel workbook worksheets list --drive-id --item-id |
List worksheets |
msm excel workbook worksheet get --drive-id --item-id --sheet |
Get worksheet |
msm excel workbook worksheet add --drive-id --item-id --name |
Add worksheet |
msm excel workbook range get --drive-id --item-id --sheet --address |
Get range |
msm excel workbook range update --drive-id --item-id --sheet --address --body |
Update range |
msm excel workbook session create --drive-id --item-id --persist |
Create session |
| Command |
Description |
msm search query --body |
Search across Microsoft 365 data |
msm search query --entity <type> --q <query> |
Helper wrapper for common entity types |
| Command |
Description |
msm intune managed-device list |
List managed devices |
msm intune managed-device get --id |
Get managed device |
msm intune managed-device delete --id |
Delete managed device (requires --beta) |
msm intune managed-device sync --id |
Sync device |
msm intune managed-device retire --id |
Retire device |
msm intune managed-device wipe --id |
Wipe device |
| Command |
Description |
msm teams joined list |
List teams the user has joined |
msm teams team get --team-id |
Get team |
msm teams channel list --team-id |
List channels |
msm teams channel get --team-id --channel-id |
Get channel |
msm teams channel create --team-id --body |
Create channel |
msm teams channel files-folder --team-id --channel-id |
Get channel files folder |
msm teams message list --team-id --channel-id |
List channel messages |
msm teams message list-replies --team-id --channel-id --message-id |
List message replies |
msm teams message send --team-id --channel-id --body |
Send channel message |
msm teams chat message list --chat-id |
List chat messages |
msm teams chat message send --chat-id --body |
Send chat message |
| Command |
Description |
msm outlook mail list |
List messages |
msm outlook mail get --message-id |
Get message |
msm outlook mail send --body |
Send mail |
msm outlook mail create-draft --body |
Create draft |
msm outlook mail delete --message-id |
Delete message |
msm outlook mail move --message-id --folder-id |
Move message |
msm outlook calendar list |
List events |
msm outlook calendar view --start --end |
Calendar view |
msm outlook calendar get --event-id |
Get event |
msm outlook calendar create --body |
Create event |
msm outlook calendar update --event-id --body |
Update event |
msm outlook contacts list |
List contacts |
msm outlook contacts get --contact-id |
Get contact |
msm outlook contacts create --body |
Create contact |
msm outlook contacts update --contact-id --body |
Update contact |
- Tokens are stored in
~/.config/msmcli/tokens.json.
- Config is stored in
~/.config/msmcli/config.json.
- Beta-only/preview areas are not official targets, except Intune which is treated as supported (admin scopes required).