# `m365`

CLI tool for Microsoft 365.

## Table of contents <!-- omit in toc -->

1. [TL:DR](#tldr)
1. [Further readings](#further-readings)
1. [Sources](#sources)

## TL:DR

```sh
# Installation.
npm install -g '@pnp/cli-microsoft365'
yarn global add '@pnp/cli-microsoft365'
docker run --rm -it 'm365pnp/cli-microsoft365':'latest'

# Disable telemetry.
m365 cli config set -k 'disableTelemetry' -v 'true'

# Login to Microsoft 365.
m365 login -t 'browser'
m365 login --authType 'password' \
  --userName 'user@contoso.com' --password 'pass@word1'
m365 login --authType 'certificate' \
  --certificateFile 'path/to/cert.pfx' --password 'pass@word1'

# Check the current login status.
m365 status

# Send messages to a chat in Teams.
# Specify *only one* of 'chatId', 'chatName' or 'userEmails'.
m365 teams chat message send --chatId 'chat-uuid' -m 'hello world'
m365 teams chat message send --chatName 'chat-display-name' -m 'hello world'
m365 teams chat message send -e 'user-email-1,…,user-email-N' -m 'hello world'
m365 teams chat message send … -m 'hello <b>world</b>'

# Send messages to a channel in Teams.
m365 teams message send -t 'team-uuid' -c 'channel-uuid' -m 'hello world'
m365 teams message send … -m 'hello <b>world</b>'

# Logout.
m365 logout
```

## Further readings

- [Website]
- [Github]
- [node.js]
- [`npm`][npm]

## Sources

All the references in the [further readings] section, plus the following:

<!-- project's references -->
[github]: https://github.com/pnp/cli-microsoft365
[website]: https://pnp.github.io/cli-microsoft365/

<!-- internal references -->
[further readings]: #further-readings
[node.js]: node.js.md
[npm]: npm.md

<!-- external references -->
