Skip to content

Latest commit

 

History

History
220 lines (180 loc) · 7.97 KB

File metadata and controls

220 lines (180 loc) · 7.97 KB
title channel: getAllRetainedMessages
description Get all retained messages across all channels in a team.
author bkeerthivasa
ms.localizationpriority medium
ms.subservice teams
doc_type apiPageType
ms.date 10/14/2024

channel: getAllRetainedMessages

Namespace: microsoft.graph

Get all retained messages across all channels in a team.

To learn more about how to use the Microsoft Teams export APIs to export content, see Export content with the Microsoft Teams export APIs.

Note

This API requires Teams retention policies to be configured. For more information, see Learn about retention for Microsoft Teams.

Note

This endpoint doesn't support retrieving retained messages from Teams private channels.

[!INCLUDE national-cloud-support]

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

[!INCLUDE permissions-table]

HTTP request

GET /teams/{teamsId}/channels/getAllRetainedMessages

Optional query parameters

This method supports the following OData query parameters to help customize the response. For general information, see OData query parameters.

Name Description
$filter The $filter query parameter supports date and time range queries on the lastModifiedDateTime property.
$top Use the $top query parameter to control the number of items per response.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this function returns a 200 OK response code and a collection of chatMessage objects in the response body.

Examples

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/teams/8b081ef6-4792-4def-b2c9-c363a1bf41d5/channels/getAllRetainedMessages

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(chatMessage)",
  "@odata.count": 2,
  "@odata.nextLink": "https://graph.microsoft.com/v1.0/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/getAllRetainedMessages?$skip=2",
  "value": [
    {
      "@odata.type": "#microsoft.graph.chatMessage",
      "id": "1616990417393",
      "replyToId": null,
      "etag": "1616990417393",
      "messageType": "message",
      "createdDateTime": "2021-03-29T04:00:17.393Z",
      "lastModifiedDateTime": "2021-03-29T04:00:17.393Z",
      "lastEditedDateTime": null,
      "deletedDateTime": null,
      "subject": null,
      "summary": null,
      "chatId": null,
      "importance": "normal",
      "locale": "en-us",
      "webUrl": "https://teams.microsoft.com/l/message/19%3Ad5d2708d408c41d98424c1c354c19db3%40thread.tacv2/1616990417393?groupId=fbe2bf47-16c8-47cf-b4a5-4b9b187c508b&tenantId=2432b57b-0abd-43db-aa7b-16eadd115d34&createdTime=1616990417393&parentMessageId=1616990417393",
      "policyViolation": null,
      "eventDetail": null,
      "from": {
        "application": null,
        "device": null,
        "conversation": null,
        "user": {
          "id": "8ea0e38b-efb3-4757-924a-5f94061cf8c2",
          "displayName": "Robin Kline",
          "userIdentityType": "aadUser"
        }
      },
      "body": {
        "contentType": "text",
        "content": "Test message"
      },
      "channelIdentity": {
        "teamId": "fbe2bf47-16c8-47cf-b4a5-4b9b187c508b",
        "channelId": "19:d5d2708d408c41d98424c1c354c19db3@thread.tacv2"
      },
      "attachments": [],
      "mentions": [],
      "reactions": []
    },
    {
      "@odata.type": "#microsoft.graph.chatMessage",
      "id": "1616990171266",
      "replyToId": "1616990032035",
      "etag": "1616990171266",
      "messageType": "message",
      "createdDateTime": "2021-03-29T03:56:11.266Z",
      "lastModifiedDateTime": "2021-03-29T03:56:11.266Z",
      "lastEditedDateTime": null,
      "deletedDateTime": null,
      "subject": null,
      "summary": null,
      "chatId": null,
      "importance": "normal",
      "locale": "en-us",
      "webUrl": "https://teams.microsoft.com/l/message/19%3A4a95f7d8db4c4e7fae857bcebe0623e6%40thread.tacv2/1616990171266?groupId=fbe2bf47-16c8-47cf-b4a5-4b9b187c508b&tenantId=2432b57b-0abd-43db-aa7b-16eadd115d34&createdTime=1616990171266&parentMessageId=1616990032035",
      "policyViolation": null,
      "eventDetail": null,
      "from": {
        "application": null,
        "device": null,
        "conversation": null,
        "user": {
          "id": "8ea0e38b-efb3-4757-924a-5f94061cf8c2",
          "displayName": "Robin Kline",
          "userIdentityType": "aadUser"
        }
      },
      "body": {
        "contentType": "text",
        "content": "Hello World"
      },
      "channelIdentity": {
        "teamId": "fbe2bf47-16c8-47cf-b4a5-4b9b187c508b",
        "channelId": "19:4a95f7d8db4c4e7fae857bcebe0623e6@thread.tacv2"
      },
      "attachments": [],
      "mentions": [],
      "reactions": []
    }
  ]
}

Related content

Microsoft Graph service-specific throttling limits