chats: getAllMessageschats: getAllMessages
Namespace: microsoft.graphNamespace: microsoft.graph
Importante
As APIs sob /beta
a versão do Microsoft Graph estão sujeitas a alterações.APIs under the /beta
version in Microsoft Graph are subject to change. Não há suporte para o uso dessas APIs em aplicativos de produção.Use of these APIs in production applications is not supported. Para determinar se uma API está disponível na versão 1.0, use o seletor de versão.To determine whether an API is available in v1.0, use the Version selector.
Obtenha todas as mensagens de todos os chats de que um usuário é um participante, incluindo chats individuais, chats de grupo e chats de reunião.Get all messages from all chats that a user is a participant in, including one-on-one chats, group chats, and meeting chats.
PermissõesPermissions
As permissões a seguir são necessárias para chamar esta API.The following permissions are required to call this API. Para saber mais, incluindo como escolher permissões, confira Permissões.To learn more, including how to choose permissions, see Permissions.
Tipo de permissãoPermission type | Permissões (da com menos para a com mais privilégios)Permissions (from least to most privileged) |
---|---|
Delegada (conta corporativa ou de estudante)Delegated (work or school account) | Sem suporteNot supported |
Delegado (conta pessoal da Microsoft)Delegated (personal Microsoft account) | Sem suporteNot supported |
AplicativoApplication | Chat.Read.All, Chat.ReadWrite.AllChat.Read.All, Chat.ReadWrite.All |
Observação
É necessário solicitar acesso antes de chamar essa API com permissões de aplicativo.Before calling this API with application permissions, you must request access. Para obter detalhes, confira APIs protegidas no Microsoft Teams.For details, see Protected APIs in Microsoft Teams.
Solicitação HTTPHTTP request
GET /users/{id}/chats/getAllMessages
Parâmetros de consulta opcionaisOptional query parameters
Esta operação dá suporte aos parâmetros de intervalo de datas para personalizar a resposta, conforme mostrado no exemplo a seguir.This operation supports date range parameters to customize the response, as shown in the following example.
GET /users/{id}/chats/getAllMessages?$top=50&$filter=lastModifiedDateTime gt 2020-06-04T18:03:11.591Z and lastModifiedDateTime lt 2020-06-05T21:00:09.413Z
Cabeçalhos de solicitaçãoRequest headers
CabeçalhoHeader | ValorValue |
---|---|
AutorizaçãoAuthorization | {token} de portador. Obrigatório.Bearer {token}. Required. |
RespostaResponse
Se bem-sucedido, este método retorna um código de resposta 200 OK
e uma coleção de objetos event no corpo da resposta.If successful, this method returns a 200 OK
response code and a list of chatMessages in the response body.
ExemploExample
SolicitaçãoRequest
GET https://graph.microsoft.com/beta/users/8b081ef6-4792-4def-b2c9-c363a1bf41d5/chats/getAllMessages
RespostaResponse
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 347
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#Collection(chatMessage)",
"@odata.count":10,
"@odata.nextLink":"https://graph.microsoft.com/beta/users/8b081ef6-4792-4def-b2c9-c363a1bf41d5/chats/getAllMessages?$skip=10",
"value":[
{
"@odata.type":"#microsoft.graph.chatMessage",
"id":"1600457965467",
"replyToId":null,
"etag":"1600457965467",
"messageType":"message",
"createdDateTime":"2020-09-18T19:39:25.467Z",
"lastModifiedDateTime":"2020-09-18T19:39:25.467Z",
"lastEditedDateTime":null,
"deletedDateTime":null,
"subject":null,
"summary":null,
"chatId":"19:0de69e5e-2da8-4cf2-821f-5e6585b2c65b_5c64e248-3269-4268-a36e-0f80314e9c39@unq.gbl.spaces",
"importance":"normal",
"locale":"en-us",
"webUrl":null,
"channelIdentity":null,
"policyViolation":null,
"from":{
"application":null,
"device":null,
"conversation":null,
"user":{
"id":"0de69e5e-2da8-4cf2-821f-5e6585b2c65b",
"displayName":"Richard Wilson",
"userIdentityType":"aadUser"
}
},
"body":{
"contentType":"html",
"content":"<div>\n<blockquote itemscope=\"\" itemtype=\"http://schema.skype.com/Reply\" itemid=\"1600457867820\">\n<strong itemprop=\"mri\" itemid=\"8:orgid:0de69e5e-2da8-4cf2-821f-5e6585b2c65b\">Richard Wilson</strong><span itemprop=\"time\" itemid=\"1600457867820\"></span>\n<p itemprop=\"preview\">1237</p>\n</blockquote>\n<p>this is a reply</p>\n</div>"
},
"attachments":[
],
"mentions":[
],
"reactions":[
]
}
]
}