I am working on sending the message to 1:1 chat or to group chat in Microsoft Teams via Microsoft Graph API using C# code but unfortunately couldn't find the C# code/classes for the same.
Actually I am able to send the message to the team's channel using the below code successfully.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var chatMessage = new ChatMessage
{
Body = new ItemBody
{
Content = "Hello world"
}
};
await graphClient.Teams["{id}"].Channels["{id}"].Messages
.Request()
.AddAsync(chatMessage);
The reference for the above code is from the below link:
https://docs.microsoft.com/en-us/graph/api/chat-post-messages?view=graph-rest-beta&tabs=csharp
Can anybody please suggest me the C# code/classes to send the message to 1:1 chat or to group chat in Microsoft Teams via Microsoft Graph API?
Please help.
Thanks in advance!