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

# teams message get

Retrieves a message from a channel in a Microsoft Teams team

## Usage

```sh
m365 teams message get [options]
```

## Options

```md definition-list
`-t, --teamId <teamId>`
: The ID of the team where the channel is located.

`-c, --channelId <channelId>`
: The ID of the channel that contains the message.

`-i, --id <id>`
: The ID of the message to retrieve.
```

<Global />

## Remarks

You can only retrieve a message from a Microsoft Teams team if you are a member of that team.

## Examples

Retrieve the specified message from a channel of the Microsoft Teams team.

```sh
m365 teams message get --teamId 5f5d7b71-1161-44d8-bcc1-3da710eb4171 --channelId 19:88f7e66a8dfe42be92db19505ae912a8@thread.skype --id 1540747442203
```

## Response

<Tabs>
  <TabItem value="JSON">

  ``` json
  {
    "id": "1540747442203",
    "replyToId": null,
    "etag": "1666799582385",
    "messageType": "message",
    "createdDateTime": "2022-10-26T15:52:00.731Z",
    "lastModifiedDateTime": "2022-10-26T15:53:02.385Z",
    "lastEditedDateTime": "2022-10-26T15:53:02.288Z",
    "deletedDateTime": null,
    "subject": "Second message Title",
    "summary": null,
    "chatId": null,
    "importance": "normal",
    "locale": "en-us",
    "webUrl": "https://teams.microsoft.com/l/message/19%388f7e66a8dfe42be92db19505ae912a8%40thread.tacv2/1540747442203?groupId=5f5d7b71-1161-44d8-bcc1-3da710eb4171&tenantId=92e59666-257b-49c3-b1fa-1bae8107f6ba&createdTime=1540747442203&parentMessageId=1540747442203",
    "policyViolation": null,
    "eventDetail": null,
    "from": {
      "application": null,
      "device": null,
      "user": {
        "id": "78ccf530-bbf0-47e4-aae6-da5f8c6fb142",
        "displayName": "John Doe",
        "userIdentityType": "aadUser",
        "tenantId": "92e59666-257b-49c3-b1fa-1bae8107f6ba"
      }
    },
    "body": {
      "contentType": "text",
      "content": "second message!"
    },
    "channelIdentity": {
      "teamId": "5f5d7b71-1161-44d8-bcc1-3da710eb4171",
      "channelId": "19:e2916df2b11046beba42d22da898383f@thread.tacv2"
    },
    "attachments": [],
    "mentions": [],
    "reactions": []
  }
  ```

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

  ``` text
  attachments         : []
  body                : {"contentType":"text","content":"second message!"}
  channelIdentity     : {"teamId":"5f5d7b71-1161-44d8-bcc1-3da710eb4171","channelId":"19:e2916df2b11046beba42d22da898383f@thread.tacv2"}
  chatId              : null
  createdDateTime     : 2022-10-26T15:52:00.731Z
  deletedDateTime     : null
  etag                : 1666799582385
  eventDetail         : null
  from                : {"application":null,"device":null,"user":{"id":"78ccf530-bbf0-47e4-aae6-da5f8c6fb142","displayName":"John Doe","userIdentityType":"aadUser","tenantId":"92e59666-257b-49c3-b1fa-1bae8107f6ba"}}
  id                  : 1540747442203
  importance          : normal
  lastEditedDateTime  : 2022-10-26T15:53:02.288Z
  lastModifiedDateTime: 2022-10-26T15:53:02.385Z
  locale              : en-us
  mentions            : []
  messageType         : message
  policyViolation     : null
  reactions           : []
  replyToId           : null
  subject             : Second message Title
  summary             : null
  webUrl              : https://teams.microsoft.com/l/message/19%388f7e66a8dfe42be92db19505ae912a8%40thread.tacv2/1540747442203?groupId=5f5d7b71-1161-44d8-bcc1-3da710eb4171&tenantId=92e59666-257b-49c3-b1fa-1bae8107f6ba&createdTime=1540747442203&parentMessageId=1540747442203
  ```

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

  ``` text
  id,replyToId,etag,messageType,createdDateTime,lastModifiedDateTime,lastEditedDateTime,deletedDateTime,subject,summary,chatId,importance,locale,webUrl,policyViolation,eventDetail,from,body,channelIdentity,attachments,mentions,reactions
  1540747442203,,1666799582385,message,2022-10-26T15:52:00.731Z,2022-10-26T15:53:02.385Z,2022-10-26T15:53:02.288Z,,Second message Title,,,normal,en-us,https://teams.microsoft.com/l/message/19%388f7e66a8dfe42be92db19505ae912a8%40thread.tacv2/1540747442203?groupId=5f5d7b71-1161-44d8-bcc1-3da710eb4171&tenantId=92e59666-257b-49c3-b1fa-1bae8107f6ba&createdTime=1540747442203&parentMessageId=1540747442203,,,"{""application"":null,""device"":null,""user"":{""id"":""78ccf530-bbf0-47e4-aae6-da5f8c6fb142"",""displayName"":""John Doe"",""userIdentityType"":""aadUser"",""tenantId"":""92e59666-257b-49c3-b1fa-1bae8107f6ba""}}","{""contentType"":""text"",""content"":""second message!""}","{""teamId"":""5f5d7b71-1161-44d8-bcc1-3da710eb4171"",""channelId"":""19:e2916df2b11046beba42d22da898383f@thread.tacv2""}",[],[],[]
  ```

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

  ```md
  # teams message get --teamId "5f5d7b71-1161-44d8-bcc1-3da710eb4171" --channelId "19:e2916df2b11046beba42d22da898383f@thread.tacv2" --id "1540747442203"

  Date: 1/3/2023

  ## undefined (1540747442203)

  Property | Value
  ---------|-------
  id | 1540747442203
  replyToId | null
  etag | 1666799582385
  messageType | message
  createdDateTime | 2022-10-26T15:52:00.731Z
  lastModifiedDateTime | 2022-10-26T15:53:02.385Z
  lastEditedDateTime | 2022-10-26T15:53:02.288Z
  deletedDateTime | null
  subject | Second message Title
  summary | null
  chatId | null
  importance | normal
  locale | en-us
  webUrl | https://teams.microsoft.com/l/message/19%388f7e66a8dfe42be92db19505ae912a8%40thread.tacv2/1540747442203?groupId=5f5d7b71-1161-44d8-bcc1-3da710eb4171&tenantId=92e59666-257b-49c3-b1fa-1bae8107f6ba&createdTime=1540747442203&parentMessageId=1540747442203
  policyViolation | null
  eventDetail | null
  ```

  </TabItem>
</Tabs>
