チャット: getAllMessages

名前空間: microsoft.graph

1 対 1 のチャット、グループチャット、会議のチャットなど、ユーザーが参加しているすべてのチャットから、すべてのメッセージを取得します。

手記: これは、 model=Amodel=B 支払いモデルをサポートする従量制課金 API です。 詳細については、「 支払いモデル」を参照してください。 クエリで支払いモデルを指定しない場合は、既定の 評価モード が使用されます。

選択した支払いモデルによっては、ライセンスも必要になる場合があります。

この API は、次の国内クラウド展開で使用できます。

グローバル サービス 米国政府機関 L4 米国政府機関 L5 (DOD) 21Vianet が運営する中国

アクセス許可

この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。

アクセス許可の種類 最小特権アクセス許可 より高い特権のアクセス許可
委任 (職場または学校のアカウント) サポートされていません。 サポートされていません。
委任 (個人用 Microsoft アカウント) サポートされていません。 サポートされていません。
Application Chat.Read.All Chat.ReadWrite.All

HTTP 要求

GET /users/{id | user-principal-name}/chats/getAllMessages

オプションのクエリ パラメーター

次の例で示すように、既定のライセンス モデルと支払いモデルに基づいて model クエリ パラメーターを使用できます。このパラメーターでは、AB の値がサポートされています。

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

このメソッドは、 $filter クエリ パラメーターをサポートします。 次の表に例を示します。

シナリオ $filter パラメーター 使用可能な値
ユーザー ID の種類によって送信されたメッセージを取得する $filter=from/user/userIdentityType eq '{teamworkUserIdentityType}' aadUser, onPremiseAadUser, anonymousGuest, federatedUser, personalMicrosoftAccountUser, skypeUser, phoneUser
アプリケーションの種類によって送信されるメッセージを取得する $filter=from/application/applicationIdentityType eq '{teamworkApplicationIdentity}' aadApplication, ボット, tenantBot, office365Connector, outgoingWebhook
ユーザー ID によって送信されたメッセージを取得する $filter=from/user/id eq '{oid}'
control(system event) メッセージを取得する $filter=messageType eq 'systemEventMessage'
制御 (システム イベント) メッセージを除外する $filter=messageType ne 'systemEventMessage'

手記: これらのフィルター句は、 or 演算子を使用して結合できます。 フィルター句はクエリに複数回表示でき、クエリ内に表示されるたびに異なる値でフィルター処理できます。

要求ヘッダー

ヘッダー
Authorization ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。

応答

成功した場合、このメソッドは 200 OK 応答コードと、応答本文で chatMessages のリストを返します。

エラー

この API には、 ライセンスと支払いの要件があります。 これらの要件が満たされていない場合、API は次のいずれかのエラーを返します。

サンプル エラーの種類 状態コード サンプル エラー メッセージ
E5 ライセンス要件が満たされていない 402 (支払いが必要) "...needs a valid license to access this API..."
"...tenant needs a valid license to access this API..."
評価容量を超えました 402 (支払いが必要) "...evaluation mode capacity has been exceeded. Use a valid billing model..."

要求

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": []
        }
    ]
}

Microsoft Graph サービス固有の調整制限