Namespace: microsoft.graph
Update the properties of a chat object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
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. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Chat.ReadWrite |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
ChatSettings.ReadWrite.Chat |
Chat.ReadWrite.All |
HTTP request
PATCH /chats/{chat-id}
Request body
In the request body, supply a JSON representation of the chat object.
The following table shows the properties that can be used with this action.
Property |
Type |
Description |
topic |
String |
The title of the chat. This can only be set for a chat with a chatType value of group . Maximum length is 250 characters. Use of ':' is not allowed. |
Response
If successful, this method returns a 200 OK response
code and the updated chat resource in the response body.
Examples
Request
PATCH https://graph.microsoft.com/v1.0/chats/19:[email protected]
Content-Type: application/json
{
"topic": "Group chat title update"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Chat
{
Topic = "Group chat title update",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Chats["{chat-id}"].PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChat()
topic := "Group chat title update"
requestBody.SetTopic(&topic)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
chats, err := graphClient.Chats().ByChatId("chat-id").Patch(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Chat chat = new Chat();
chat.setTopic("Group chat title update");
Chat result = graphClient.chats().byChatId("{chat-id}").patch(chat);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Chat;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Chat();
$requestBody->setTopic('Group chat title update');
$result = $graphServiceClient->chats()->byChatId('chat-id')->patch($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Teams
$params = @{
topic = "Group chat title update"
}
Update-MgChat -ChatId $chatId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.chat import Chat
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Chat(
topic = "Group chat title update",
)
result = await graph_client.chats.by_chat_id('chat-id').patch(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#chats/$entity",
"id": "19:[email protected]",
"topic": "Group chat title update",
"createdDateTime": "2020-12-04T23:11:16.175Z",
"lastUpdatedDateTime": "2020-12-04T23:12:19.943Z",
"chatType": "group"
}