chatMessage を更新する

chatMessage オブジェクトを更新します。 policyViolation プロパティを除き、chatMessage のすべてのプロパティは、委任されたアクセス許可のシナリオで更新できます。 アプリケーションのアクセス許可シナリオでは、chatMessagepolicyViolation プロパティのみを更新できます。

この更新プログラムは、メンバーが Microsoft Teams ユーザーであるチャットでのみ機能します。 参加者の 1 人が Skype を使用している場合、操作は失敗します。

このメソッドはフェデレーションをサポートしていません。 メッセージを送信したテナント内のユーザーのみが、指定されたチャット メッセージに対してデータ損失防止 (DLP) 更新を実行できます。

注:

アプリケーションのアクセス許可で使用すると、この API は従量制課金されます。 これは、支払いモデルを model=A サポートしています。 詳細については、「 支払いモデル」を参照してください。 クエリで支払いモデルを指定しない場合は、既定の 評価モード が使用されます。

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

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

アクセス許可

この API を呼び出すには、次のいずれかのアクセス許可が必要です。 アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。

チャネルのアクセス許可

アクセス許可の種類 アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校のアカウント) ChannelMessage.ReadWrite、Group.ReadWrite.All
委任 (個人用 Microsoft アカウント) サポートされていません。
アプリケーション ChannelMessage.UpdatePolicyViolation.All, Group.ReadWrite.All**

注:

Group.ReadWrite.All アクセス許可は、下位互換性のためにのみサポートされます。 前の表に記載されている別のアクセス許可を使用するようにソリューションを更新し、今後これらのアクセス許可を使用しないようにすることをお勧めします。

チャットのアクセス許可

アクセス許可の種類 アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校のアカウント) Chat.ReadWrite
委任 (個人用 Microsoft アカウント) サポートされていません。
アプリケーション Chat.UpdatePolicyViolation.All、Chat.ReadWrite.All

HTTP 要求

チャネルchatMessage を更新するには:

PATCH /teams/(team-id)/channels/{channel-id}/messages/{message-id}
PATCH /teams/(team-id)/channels/{channel-id}/messages/{message-id}/replies/{reply-id}

チャット内の chatMessage を更新するには:

PATCH /chats/{chatThread-id}/messages/{message-id}

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

次の例に示すように、値 Aのみをサポートするクエリ パラメーターを使用modelできます。

PATCH /teams/(team-id)/channels/{channel-id}/messages/{message-id}?model=A
PATCH /teams/(team-id)/channels/{channel-id}/messages/{message-id}/replies/{reply-id}?model=A
PATCH /chats/{chatThread-id}/messages/{message-id}?model=A

が指定されていない model 場合は、 評価モード が使用されます。

要求ヘッダー

名前 説明
Authorization ベアラー {token}。 必須です。 認証と承認の詳細については、こちらをご覧ください。
Content-Type application/json. 必須です。

要求本文

委任されたアクセス許可を使用するアプリケーションの場合: 要求本文で、変更する必要があるプロパティを指定して、 chatMessage オブジェクトの JSON 表現を指定します。

アプリケーションのアクセス許可を使用するアプリケーションの場合: 要求本文で、policyViolation プロパティのみを指定して、chatMessage オブジェクトの JSON 表現を指定します。

応答本文

委任されたアクセス許可を使用するアプリケーションの場合: 成功した場合、このメソッドは応答を 204 No Content 返します。

アプリケーションのアクセス許可を使用するアプリケーションの場合: 成功した場合、このメソッドは応答を 200 OK 返します。

例 1: アプリケーションのアクセス許可を使用して policyViolation プロパティを更新する

要求

次の例は、アプリケーションのアクセス許可を使用して、Microsoft Teams チャネル メッセージの policyViolation プロパティを更新する要求を示しています。

PATCH https://graph.microsoft.com/v1.0/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19%3Aa21b0b0c05194ebc9e30000000000f61%40thread.skype
Content-Type: application/json

{
  "policyViolation": {
    "policyTip": {
      "generalText" : "This item has been blocked by the administrator.",
      "complianceUrl" : "https://contoso.com/dlp-policy-page",
      "matchedConditionDescriptions" : ["Credit Card Number"]
    },
    "verdictDetails" : "AllowOverrideWithoutJustification,AllowFalsePositiveOverride",
    "dlpAction" : "BlockAccess"
  }
}

応答

次の例は応答を示しています。

HTTP/1.1 200 OK

例 2: 委任されたアクセス許可を使用してメッセージのプロパティを更新する

要求

次の例は、委任されたアクセス許可を使用して Microsoft Teams チャネル メッセージのプロパティを更新する要求を示しています。

PATCH https://graph.microsoft.com/v1.0/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19%3Aa21b0b0c05194ebc9e30000000000f61%40thread.skype
Content-Type: application/json

{
  "messageType": "message",
  "subject": null,
  "summary": null,
  "importance": "normal",
  "locale": "en-us",
  "from": {
    "application": null,
    "device": null,
    "user": {
      "id": "3b102402-813e-4e17-a6b2-f841aef1fdfc",
      "displayName": "Lam Cong",
      "userIdentityType": "aadUser"
    },
    "conversation": null
  },
  "body": {
    "contentType": "text",
    "content": "Edit text only"
  },
  "attachments": [],
  "mentions": [],
  "reactions": [],
  "messageHistory": []
}

応答

次の例は応答を示しています。

HTTP/1.1 204 No Content

例 3: 委任されたアクセス許可を使用してメッセージのメンションを更新する

要求

次の例は、委任されたアクセス許可を使用して Microsoft Teams チャネル メッセージのメンションを更新する要求を示しています。

PATCH https://graph.microsoft.com/v1.0/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19%3Aa21b0b0c05194ebc9e30000000000f61%40thread.skype
Content-Type: application/json

{
  "messageType": "message",
  "deletedDateTime": null,
  "subject": null,
  "summary": null,
  "importance": "normal",
  "locale": "en-us",
  "from": {
    "application": null,
    "device": null,
    "conversation": null,
    "user": {
      "id": "6b3f3c54-d09c-4fdd-b146-9b514a8a4f40",
      "displayName": "Lam Cong",
      "userIdentityType": "aadUser"
    }
  },
  "body": {
    "contentType": "html",
    "content": "<div><div>\n<div>\n<div>\n<div>\n<div><at id=\"0\">Raghav</at><at id=\"1\">TestGlobalBot</at> YEAH"
  },
  "attachments": [],
  "mentions": [
    {
      "id": 0,
      "mentionText": "Raghav",
      "mentioned": {
        "application": null,
        "device": null,
        "conversation": null,
        "user": {
          "id": "f1b66449-b46d-49b0-9c3c-53c10234c818e",
          "displayName": "Lam Cong",
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "id": 1,
      "mentionText": "TestGlobalBot",
      "mentioned": {
        "application": {
          "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
          "displayName": "TestGlobalBot",
          "applicationIdentityType": "bot"
        },
        "device": null,
        "conversation": null,
        "user": null
      }
    }
  ],
  "reactions": [],
  "messageHistory": []
}

応答

次の例は応答を示しています。

HTTP/1.1 204 No Content

例 4: 委任されたアクセス許可を使用して、メッセージの添付ファイルを含むコンテンツを更新する

要求

次の例は、委任されたアクセス許可を使用して Microsoft Teams チャネル メッセージの添付ファイルを更新する要求を示しています。

PATCH https://graph.microsoft.com/v1.0/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19%3Aa21b0b0c05194ebc9e30000000000f61%40thread.skype
Content-Type: application/json

{
  "messageType": "message",
  "subject": null,
  "summary": null,
  "importance": "normal",
  "locale": "en-us",
  "from": {
    "application": null,
    "device": null,
    "user": {
      "id": "3b102402-813e-4e17-a6b2-f841aef1fdfc",
      "displayName": "Lam Cong",
      "userIdentityType": "aadUser"
    },
    "conversation": null
  },
  "body": {
    "contentType": "html",
    "content": "<p><em>text</em></p><attachment id=\"e8f78756199240b88448ae0fc6db112d\"></attachment><attachment id=\"638464e32834471ea202007da60a5ae6\"></attachment>"
  },
  "attachments": [
    {
      "id": "e8f78756199240b88448ae0fc6db112d",
      "contentType": "application/vnd.microsoft.card.hero",
      "contentUrl": null,
      "content": "{\r\n  \"title\": \"*title*\",\r\n  \"subtitle\": \"*subtitle*\",\r\n  \"text\": \"Have you found yourself scratching your head trying to figure these questions out? Frustrated trying to access some of the goodies unique to the Microsoft Teams platform?  Well, fear not, Bot Builder SDK Extension for Teams in .NET and Node flavors is here!  Just head on over to Nuget or NPM to download our tasty helpers, sure to speed up your prep time so you can spend more time maximizing the flavor of the bots you're cooking up.Here’s a small sample of some recipes to whet your appetite.\",\r\n  \"images\": [\r\n    {\r\n      \"url\": \"https://us-api.asm.skype.com/v1/objects/0-eus-d8-ced0c9567ee7b0b233b987bd32f9eacd/views/img_preview\"\r\n    }\r\n  ],\r\n  \"buttons\": [\r\n    {\r\n      \"type\": \"openUrl\",\r\n      \"image\": \"https://urlp.asm.skype.com/v1/url/content?url=https%3a%2f%2fcdn2.iconfinder.com%2fdata%2ficons%2fsocial-icons-33%2f128%2fTrello-128.png\",\r\n      \"title\": \"😃😃 click me 😃😃\",\r\n      \"value\": \"http://microsoft.com\"\r\n    },\r\n    {\r\n      \"type\": \"imback\",\r\n      \"title\": \"&i am back& <>= \\\"\",\r\n      \"value\": \"&i am back& <>= \\\"\"\r\n    },\r\n    {\r\n      \"type\": \"openUrl\",\r\n      \"title\": \"Open URL\",\r\n      \"value\": \"http://google.com\"\r\n    }\r\n  ]\r\n}",
      "name": null,
      "thumbnailUrl": null
    },
    {
      "id": "638464e32834471ea202007da60a5ae6",
      "contentType": "application/vnd.microsoft.card.hero",
      "contentUrl": null,
      "content": "{\r\n  \"title\": \"*title*\",\r\n  \"subtitle\": \"*subtitle*\",\r\n  \"text\": \"Have you found yourself scratching your head trying to figure these questions out? Frustrated trying to access some of the goodies unique to the Microsoft Teams platform?  Well, fear not, Bot Builder SDK Extension for Teams in .NET and Node flavors is here!  Just head on over to Nuget or NPM to download our tasty helpers, sure to speed up your prep time so you can spend more time maximizing the flavor of the bots you're cooking up.Here’s a small sample of some recipes to whet your appetite.\",\r\n  \"images\": [\r\n    {\r\n      \"url\": \"https://us-api.asm.skype.com/v1/objects/0-eus-d8-ced0c9567ee7b0b233b987bd32f9eacd/views/img_preview\"\r\n    }\r\n  ],\r\n  \"buttons\": [\r\n    {\r\n      \"type\": \"messageBack\",\r\n      \"title\": \"&message back& <>= \\\"\",\r\n      \"text\": \"text = &message back& <>= \\\"\",\r\n      \"displayText\": \"displayText = &message back& <>= \\\"\",\r\n      \"value\": {\r\n        \"text\": \"some text 2\"\r\n      }\r\n    }\r\n  ]\r\n}",
      "name": null,
      "thumbnailUrl": null
    }
  ],
  "mentions": [],
  "reactions": [],
  "messageHistory": []
}

応答

次の例は応答を示しています。

HTTP/1.1 204 No Content

例 5: 委任されたアクセス許可を使用してメッセージ内のリアクションを更新する

要求

次の例は、委任されたアクセス許可を使用して Microsoft Teams チャネル メッセージの reactions プロパティを更新する要求を示しています。

PATCH https://graph.microsoft.com/v1.0/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19%3Aa21b0b0c05194ebc9e30000000000f61%40thread.skype
Content-Type: application/json

{
  "messageType": "message",
  "subject": null,
  "summary": null,
  "importance": "normal",
  "locale": "en-us",
  "from": {
    "application": null,
    "device": null,
    "user": {
      "id": "3b102402-813e-4e17-a6b2-f841aef1fdfc",
      "displayName": "Lam Cong",
      "userIdentityType": "aadUser"
    },
    "conversation": null
  },
  "body": {
    "contentType": "html",
    "content": "<p><em>text</em></p><attachment id=\"e8f78756199240b88448ae0fc6db112d\"></attachment><attachment id=\"638464e32834471ea202007da60a5ae6\"></attachment>"
  },
  "attachments": [
    {
      "id": "e8f78756199240b88448ae0fc6db112d",
      "contentType": "application/vnd.microsoft.card.hero",
      "contentUrl": null,
      "content": "{\r\n  \"title\": \"*title*\",\r\n  \"subtitle\": \"*subtitle*\",\r\n  \"text\": \"Have you found yourself scratching your head trying to figure these questions out? Frustrated trying to access some of the goodies unique to the Microsoft Teams platform?  Well, fear not, Bot Builder SDK Extension for Teams in .NET and Node flavors is here!  Just head on over to Nuget or NPM to download our tasty helpers, sure to speed up your prep time so you can spend more time maximizing the flavor of the bots you're cooking up.Here’s a small sample of some recipes to whet your appetite.\",\r\n  \"images\": [\r\n    {\r\n      \"url\": \"https://us-api.asm.skype.com/v1/objects/0-eus-d8-ced0c9567ee7b0b233b987bd32f9eacd/views/img_preview\"\r\n    }\r\n  ],\r\n  \"buttons\": [\r\n    {\r\n      \"type\": \"openUrl\",\r\n      \"image\": \"https://urlp.asm.skype.com/v1/url/content?url=https%3a%2f%2fcdn2.iconfinder.com%2fdata%2ficons%2fsocial-icons-33%2f128%2fTrello-128.png\",\r\n      \"title\": \"😃😃 click me 😃😃\",\r\n      \"value\": \"http://microsoft.com\"\r\n    },\r\n    {\r\n      \"type\": \"imback\",\r\n      \"title\": \"&i am back& <>= \\\"\",\r\n      \"value\": \"&i am back& <>= \\\"\"\r\n    },\r\n    {\r\n      \"type\": \"openUrl\",\r\n      \"title\": \"Open URL\",\r\n      \"value\": \"http://google.com\"\r\n    }\r\n  ]\r\n}",
      "name": null,
      "thumbnailUrl": null
    },
    {
      "id": "638464e32834471ea202007da60a5ae6",
      "contentType": "application/vnd.microsoft.card.hero",
      "contentUrl": null,
      "content": "{\r\n  \"title\": \"*title*\",\r\n  \"subtitle\": \"*subtitle*\",\r\n  \"text\": \"Have you found yourself scratching your head trying to figure these questions out? Frustrated trying to access some of the goodies unique to the Microsoft Teams platform?  Well, fear not, Bot Builder SDK Extension for Teams in .NET and Node flavors is here!  Just head on over to Nuget or NPM to download our tasty helpers, sure to speed up your prep time so you can spend more time maximizing the flavor of the bots you're cooking up.Here’s a small sample of some recipes to whet your appetite.\",\r\n  \"images\": [\r\n    {\r\n      \"url\": \"https://us-api.asm.skype.com/v1/objects/0-eus-d8-ced0c9567ee7b0b233b987bd32f9eacd/views/img_preview\"\r\n    }\r\n  ],\r\n  \"buttons\": [\r\n    {\r\n      \"type\": \"messageBack\",\r\n      \"title\": \"&message back& <>= \\\"\",\r\n      \"text\": \"text = &message back& <>= \\\"\",\r\n      \"displayText\": \"displayText = &message back& <>= \\\"\",\r\n      \"value\": {\r\n        \"text\": \"some text 2\"\r\n      }\r\n    }\r\n  ]\r\n}",
      "name": null,
      "thumbnailUrl": null
    }
  ],
  "mentions": [],
  "reactions": [
    {
      "reactionType": "angry",
      "createdDateTime": "2018-10-21T08:10:30.489Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "f1b66449-b46d-49b0-9c3c-53c10a5c818e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "laugh",
      "createdDateTime": "2018-10-21T08:10:32.489Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "like",
      "createdDateTime": "2018-10-21T02:17:14.67Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "f1b66449-b46d-49b0-9c3c-53c10a5c818e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "like",
      "createdDateTime": "2018-10-21T02:34:40.3Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "4c9041b7-449a-40f7-8855-56da239b9fd1",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "like",
      "createdDateTime": "2018-10-21T08:10:25.489Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "heart",
      "createdDateTime": "2018-10-21T08:10:31.489Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "sad",
      "createdDateTime": "2018-10-21T08:10:33.489Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    },
    {
      "reactionType": "surprised",
      "createdDateTime": "2018-10-21T08:10:34.489Z",
      "user": {
        "application": null,
        "device": null,
        "user": {
          "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
          "displayName": null,
          "userIdentityType": "aadUser"
        }
      }
    }
  ],
  "messageHistory": [
    {
      "modifiedDateTime": "2018-10-21T08:10:30.489Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "angry",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "f1b66449-b46d-49b0-9c3c-53c10a5c818e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T08:10:32.489Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "laugh",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T02:17:14.67Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "like",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "f1b66449-b46d-49b0-9c3c-53c10a5c818e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T02:34:40.3Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "like",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "4c9041b7-449a-40f7-8855-56da239b9fd1",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T08:10:25.489Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "like",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T08:10:31.489Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "heart",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T08:10:33.489Z",
      "actions": "reactionAdded",
      "reaction": {
        "reactionType": "sad",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    },
    {
      "modifiedDateTime": "2018-10-21T08:10:34.489Z",
      "actions": "surprised",
      "reaction": {
        "reactionType": "sad",
        "user": {
          "application": null,
          "device": null,
          "user": {
            "id": "03a02232-d8f5-4970-a77e-6e8c76ce7a4e",
            "displayName": null,
            "userIdentityType": "aadUser"
          }
        }
      }
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 204 No Content