import Global from '../../_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# teams chat message list

Lists all messages from a Microsoft Teams chat conversation.

## Usage

```sh
m365 teams chat message list [options]
```

## Options

```md definition-list
`-i, --chatId <chatId>`
: The ID of the chat conversation.

`--createdEndDateTime [createdEndDateTime]`
: Time indicating the exclusive end of a time range when the message was created.

`--endDateTime [endDateTime]`
: (deprecated. Use `createdEndDateTime` instead) Time indicating the exclusive end of a time range when the message was created.

`--modifiedStartDateTime [modifiedStartDateTime]`
: Time indicating the inclusive start of a time range when the message was last modified. Cannot be combined with `createdEndDateTime`.

`--modifiedEndDateTime [modifiedEndDateTime]`
: Time indicating the exclusive end of a time range when the message was last modified. Cannot be combined with `createdEndDateTime`.
```

<Global />

## Permissions

<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions      |
  |-----------------|------------------|
  | Microsoft Graph | ChatMessage.Read |

  </TabItem>
  <TabItem value="Application">

  | Resource        | Permissions          |
  |-----------------|----------------------|
  | Microsoft Graph | ChatMessage.Read.All |

  </TabItem>
</Tabs>

## Examples

List the messages from a Microsoft Teams chat conversation

```sh
m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2
```

List messages from a Microsoft Teams chat conversation created before November 1, 2022

```sh
m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --createdEndDateTime 2022-11-01T00:00:00Z
```

List messages from a Microsoft Teams chat conversation modified after October 1, 2025

```sh
m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --modifiedStartDateTime 2025-10-01T00:00:00Z
```

List messages from a Microsoft Teams chat conversation modified between October 1, 2025 and November 1, 2025

```sh
m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --modifiedStartDateTime 2025-10-01T00:00:00Z --modifiedEndDateTime 2025-11-01T00:00:00Z
```

## Response

<Tabs>
  <TabItem value="JSON">

  ```json
  [
    {
      "id": "1667653590582",
      "replyToId": null,
      "etag": "1667653590582",
      "messageType": "message",
      "createdDateTime": "2022-11-05T13:06:30.582Z",
      "lastModifiedDateTime": "2022-11-05T13:06:30.582Z",
      "lastEditedDateTime": null,
      "deletedDateTime": null,
      "subject": null,
      "summary": null,
      "chatId": "19:2da4c29f6d7041eca70b638b43d45437@thread.v2",
      "importance": "normal",
      "locale": "en-us",
      "webUrl": null,
      "channelIdentity": null,
      "policyViolation": null,
      "eventDetail": null,
      "from": {
        "application": null,
        "device": null,
        "user": {
          "id": "78ccf530-bbf0-47e4-aae6-da5f8c6fb142",
          "displayName": "John Doe",
          "userIdentityType": "aadUser",
          "tenantId": "446355e4-e7e3-43d5-82f8-d7ad8272d55b"
        }
      },
      "body": {
        "contentType": "html",
        "content": "<p>Hello world</p>"
      },
      "attachments": [],
      "mentions": [],
      "reactions": []
    }
  ]
  ```

  </TabItem>
  <TabItem value="Text">

  ```text
  id             createdDateTime           shortBody
  -------------  ------------------------  ------------------
  1667653590582  2022-11-05T13:06:30.582Z  <p>Hello world</p>
  ```

  </TabItem>
  <TabItem value="CSV">

  ```csv
  id,createdDateTime,shortBody
  1667653590582,2022-11-05T13:06:30.582Z,<p>Hello world</p>
  ```

  </TabItem>
  <TabItem value="Markdown">

  ```md
  # teams chat message list --chatId "19:04355ecd-2124-4097-bc2b-c2295a71d7a3_e1251b10-1ba4-49e3-b35a-933e3f21772b@unq.gbl.spaces"

  Date: 5/8/2023

  ## 1662642685689

  Property | Value
  ---------|-------
  id | 1662642685689
  etag | 1667653590582
  messageType | message
  createdDateTime | 2022-11-05T13:06:30.582Z
  lastModifiedDateTime | 2022-11-05T13:06:30.582Z
  chatId | 19:04355ecd-2124-4097-bc2b-c2295a71d7a3_e1251b10-1ba4-49e3-b35a-933e3f21772b@unq.gbl.spaces
  importance | normal
  locale | en-us
  body | <p>Hello world</p>
  shortBody | <p>Hello world</p>
  ```

  </TabItem>
</Tabs>
