Share via

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 Security | Microsoft Graph
Developer technologies | C#
Developer technologies | 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.

{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,431 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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.