チャット: getAllMessages
名前空間: microsoft.graph
1 対 1 のチャット、グループチャット、会議のチャットなど、ユーザーが参加しているすべてのチャットから、すべてのメッセージを取得します。
注: この API には、ライセンス要件と支払い要件があります。
model=Aとmodel=Bクエリ パラメーターの両方をサポートしています。 モデルが指定されていない場合は、評価モードが使用されます。
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。
| アクセス許可の種類 | アクセス許可 (特権の小さいものから大きいものへ) |
|---|---|
| 委任 (職場または学校のアカウント) | サポートされていません。 |
| 委任 (個人用 Microsoft アカウント) | サポートされていません。 |
| アプリケーション | Chat.Read.All、Chat.ReadWrite.All |
注意
アプリケーションのアクセス許可でこの API を呼び出す前に、アクセスを要求する必要があります。 詳細については、「Microsoft Teams の保護された API」を参照してください。
HTTP 要求
GET /users/{id | user-principal-name}/chats/getAllMessages
オプションのクエリ パラメーター
次の例に示すように、優先ライセンスと支払いモデル に基づいてA と B の値をサポートする model クエリを使用できます。
model が指定されていない場合、 評価モード が使用されます。
GET /users/{id | user-principal-name}/chats/getAllMessages?model=A
GET /users/{id | user-principal-name}/chats/getAllMessages?model=B
model が指定されていない場合、評価モード が使用されます。
次の例が示すように、この操作は 日付範囲のパラメーター をサポートし、応答をカスタマイズします。
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
要求ヘッダー
| ヘッダー | 値 |
|---|---|
| Authorization | ベアラー {token}。必須。 |
応答
成功した場合、このメソッドは 200 OK 応答コードと、応答本文で chatMessages のリストを返します。
例
要求
GET https://graph.microsoft.com/v1.0/users/0b4f1cf6-54c8-4820-bbb7-2a1f4257ade5/chats/getAllMessages?$top=2
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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/users('0b4f1cf6-54c8-4820-bbb7-2a1f4257ade5')/chats/getallMessages?$top=2&$skiptoken=U2tpcFZhbHVlPTIjTWFpbGJveEZvbGRlcj1NYWlsRm9sZGVycy9UZWFtc01lc3NhZ2VzRGF0YQ%3d%3d",
"value": [
{
"@odata.type": "#microsoft.graph.chatMessage",
"id": "1621973534864",
"replyToId": null,
"etag": "1621973534864",
"messageType": "message",
"createdDateTime": "2021-05-25T20:12:14.864Z",
"lastModifiedDateTime": "2021-05-25T20:12:14.864Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": "19:3c9e92a344704332bbf5bda58f4d37b1@thread.v2",
"importance": "normal",
"locale": "en-us",
"webUrl": null,
"channelIdentity": null,
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"user": {
"id": "0b4f1cf6-54c8-4820-bbb7-2a1f4257ade5",
"displayName": "user1 a",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "text",
"content": "Hello user2, user 3"
},
"attachments": [],
"mentions": [],
"reactions": []
},
{
"@odata.type": "#microsoft.graph.chatMessage",
"id": "1622762567488",
"replyToId": null,
"etag": "1622762567488",
"messageType": "message",
"createdDateTime": "2021-06-03T23:22:47.488Z",
"lastModifiedDateTime": "2021-06-03T23:22:47.488Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": "19:0b4f1cf6-54c8-4820-bbb7-2a1f4257ade5_0d7c63d3-1306-4eec-8f21-588a70fb6ef1@unq.gbl.spaces",
"importance": "normal",
"locale": "en-us",
"webUrl": null,
"channelIdentity": null,
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"user": {
"id": "0b4f1cf6-54c8-4820-bbb7-2a1f4257ade5",
"displayName": "user1 a",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "text",
"content": "hi user2"
},
"attachments": [],
"mentions": [],
"reactions": []
}
]
}
フィードバック
フィードバックの送信と表示