|
| 1 | +--- |
| 2 | +title: "Create plannerTaskChatMessage" |
| 3 | +description: "Create a new chat message on a planner task." |
| 4 | +author: "pavlodatsiuk" |
| 5 | +ms.localizationpriority: medium |
| 6 | +ms.subservice: "planner" |
| 7 | +doc_type: apiPageType |
| 8 | +ms.date: 01/23/2026 |
| 9 | +--- |
| 10 | + |
| 11 | +# Create plannerTaskChatMessage |
| 12 | + |
| 13 | +Namespace: microsoft.graph |
| 14 | + |
| 15 | +[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)] |
| 16 | + |
| 17 | +Create a new [plannerTaskChatMessage](../resources/plannertaskchatmessage.md) on a [plannerTask](../resources/plannertask.md). |
| 18 | + |
| 19 | +[!INCLUDE [national-cloud-support](../../includes/global-us.md)] |
| 20 | + |
| 21 | +## Permissions |
| 22 | + |
| 23 | +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](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference). |
| 24 | + |
| 25 | +<!-- { "blockType": "permissions", "name": "plannertask_post_messages" } --> |
| 26 | +[!INCLUDE [permissions-table](../includes/permissions/plannertask-post-messages-permissions.md)] |
| 27 | + |
| 28 | +## HTTP request |
| 29 | + |
| 30 | +<!-- { "blockType": "ignored" } --> |
| 31 | +```http |
| 32 | +POST /planner/tasks/{task-id}/messages |
| 33 | +``` |
| 34 | + |
| 35 | +## Request headers |
| 36 | + |
| 37 | +| Name | Description| |
| 38 | +|:-----------|:-----------| |
| 39 | +|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).| |
| 40 | +| Content-Type | application/json. Required.| |
| 41 | + |
| 42 | +## Request body |
| 43 | + |
| 44 | +In the request body, supply a JSON representation of a [plannerTaskChatMessage](../resources/plannertaskchatmessage.md) object. |
| 45 | + |
| 46 | +The following table lists the properties that you can set when you create a **plannerTaskChatMessage**. |
| 47 | + |
| 48 | +| Property | Type |Description| |
| 49 | +|:---------------|:--------|:----------| |
| 50 | +| content | String | The content of the chat message. This property supports plain text and sanitized HTML. Required. | |
| 51 | +| mentions | [plannerTaskChatMention](../resources/plannertaskchatmention.md) collection | The list of mentions in the message. Optional. | |
| 52 | + |
| 53 | +## Response |
| 54 | + |
| 55 | +If successful, this method returns a `201 Created` response code and a [plannerTaskChatMessage](../resources/plannertaskchatmessage.md) object in the response body. |
| 56 | + |
| 57 | +This method can return any of the [HTTP status codes](/graph/errors). The most common errors that apps should handle for this method are the 400, 403, and 404 responses. For more information about these errors, see [Common Planner error conditions](../resources/planner-overview.md#common-planner-error-conditions). |
| 58 | + |
| 59 | +## Examples |
| 60 | + |
| 61 | +### Example 1: Create a message |
| 62 | + |
| 63 | +#### Request |
| 64 | + |
| 65 | +The following example shows a request to create a chat message. |
| 66 | + |
| 67 | +<!-- { |
| 68 | + "blockType": "request", |
| 69 | + "name": "plannertask_post_messages", |
| 70 | + "sampleKeys": ["01gzSlKkIUSUl6DF_EilrmQAKDhh"] |
| 71 | +}--> |
| 72 | +```http |
| 73 | +POST https://graph.microsoft.com/beta/planner/tasks/01gzSlKkIUSUl6DF_EilrmQAKDhh/messages |
| 74 | +Content-type: application/json |
| 75 | +
|
| 76 | +{ |
| 77 | + "content": "This is a new chat message" |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +#### Response |
| 82 | + |
| 83 | +The following example shows the response. |
| 84 | + |
| 85 | +<!-- { |
| 86 | + "blockType": "response", |
| 87 | + "truncated": true, |
| 88 | + "@odata.type": "microsoft.graph.plannerTaskChatMessage" |
| 89 | +} --> |
| 90 | +```http |
| 91 | +HTTP/1.1 201 Created |
| 92 | +Content-type: application/json |
| 93 | +
|
| 94 | +{ |
| 95 | + "@odata.context": "https://graph.microsoft.com/beta/$metadata#planner/tasks('01gzSlKkIUSUl6DF_EilrmQAKDhh')/messages/$entity", |
| 96 | + "id": "5bde7bc8-d998-4e8a-8159-93d4d7ccc3b5", |
| 97 | + "messageType": "richTextHtml", |
| 98 | + "content": "This is a new chat message", |
| 99 | + "createdDateTime": "2025-12-05T17:49:39.593Z", |
| 100 | + "parentEntityId": "01gzSlKkIUSUl6DF_EilrmQAKDhh", |
| 101 | + "deletedTime": null, |
| 102 | + "editedTime": null, |
| 103 | + "mentions": [], |
| 104 | + "reactions": [], |
| 105 | + "createdBy": { |
| 106 | + "user": { |
| 107 | + "id": "6463a5ce-2119-4198-9f2a-628761df4a62" |
| 108 | + } |
| 109 | + } |
| 110 | +} |
| 111 | +``` |
| 112 | + |
| 113 | +### Example 2: Create a message with mentions |
| 114 | + |
| 115 | +#### Request |
| 116 | + |
| 117 | +The following example shows a request to create a chat message with a user mention. |
| 118 | + |
| 119 | +<!-- { |
| 120 | + "blockType": "request", |
| 121 | + "name": "plannertask_post_messages_with_mentions", |
| 122 | + "sampleKeys": ["01gzSlKkIUSUl6DF_EilrmQAKDhh"] |
| 123 | +}--> |
| 124 | +```http |
| 125 | +POST https://graph.microsoft.com/beta/planner/tasks/01gzSlKkIUSUl6DF_EilrmQAKDhh/messages |
| 126 | +Content-type: application/json |
| 127 | +
|
| 128 | +{ |
| 129 | + "content": "<div><span itemid=\"0\" itemtype=\"https://schema.skype.com/Mention/Person\"></span> Please review this task</div>", |
| 130 | + "mentions": [ |
| 131 | + { |
| 132 | + "mentioned": "6463a5ce-2119-4198-9f2a-628761df4a62", |
| 133 | + "position": 0, |
| 134 | + "mentionType": "user" |
| 135 | + } |
| 136 | + ] |
| 137 | +} |
| 138 | +``` |
| 139 | + |
| 140 | +#### Response |
| 141 | + |
| 142 | +The following example shows the response. |
| 143 | + |
| 144 | +<!-- { |
| 145 | + "blockType": "response", |
| 146 | + "truncated": true, |
| 147 | + "@odata.type": "microsoft.graph.plannerTaskChatMessage" |
| 148 | +} --> |
| 149 | +```http |
| 150 | +HTTP/1.1 201 Created |
| 151 | +Content-type: application/json |
| 152 | +
|
| 153 | +{ |
| 154 | + "@odata.context": "https://graph.microsoft.com/beta/$metadata#planner/tasks('01gzSlKkIUSUl6DF_EilrmQAKDhh')/messages/$entity", |
| 155 | + "id": "7cde8bc9-e109-5f9b-9260-04e5e8ddc4c6", |
| 156 | + "messageType": "richTextHtml", |
| 157 | + "content": "<div><span itemid=\"0\" itemtype=\"https://schema.skype.com/Mention/Person\"></span> Please review this task</div>", |
| 158 | + "createdDateTime": "2025-12-05T17:49:39.593Z", |
| 159 | + "parentEntityId": "01gzSlKkIUSUl6DF_EilrmQAKDhh", |
| 160 | + "deletedTime": null, |
| 161 | + "editedTime": null, |
| 162 | + "mentions": [ |
| 163 | + { |
| 164 | + "mentioned": "6463a5ce-2119-4198-9f2a-628761df4a62", |
| 165 | + "position": 0, |
| 166 | + "mentionType": "user" |
| 167 | + } |
| 168 | + ], |
| 169 | + "reactions": [], |
| 170 | + "createdBy": { |
| 171 | + "user": { |
| 172 | + "id": "6463a5ce-2119-4198-9f2a-628761df4a62" |
| 173 | + } |
| 174 | + } |
| 175 | +} |
| 176 | +``` |
| 177 | + |
| 178 | +<!-- { |
| 179 | + "type": "#page.annotation", |
| 180 | + "description": "Create plannerTaskChatMessage", |
| 181 | + "keywords": "", |
| 182 | + "section": "documentation", |
| 183 | + "tocPath": "" |
| 184 | +}--> |
0 commit comments