TEAMS 's CHATMESSAGE

Gene-Enli (蔡承祐) 0 Reputation points
2024-12-02T09:33:35.44+00:00

Please ask C# how to use clientId, tenantId, clientSecret, chatId these parameters to send messages to the group

graphClient.Chats[chatId].Messages.PostAsync(requestBody);

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,651 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,152 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 43,726 Reputation points
    2024-12-03T09:11:50.19+00:00

    Hi @Gene-Enli (蔡承祐)

    Sending chat messages in an application-only context is not supported, and application permissions can only be used to import third-party platform messages.

    User's image

    To send chat messages, you should use delegated permissions with user participation.

    User's image

    Code snippet you can follow: https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=csharp#authorization-code-provider.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.