.NET
Microsoft Technologies based on the .NET software framework.
4,069 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
We are trying to post a message to teams channel, with Channel.SendMessage delegated permissions.
And here is the code snippet.
var options = new OnBehalfOfCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
``` };
var oboToken =""
var onBehalfOfCredential = new OnBehalfOfCredential(
tenantId, clientId, clientSecret, oboToken, options);
var requestBody = new ChatMessage
{
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = teamsCardData,
``` },
``` };
var result = await graphClient.Teams[{ teamId}].Channels[{channelId}].Messages.PostAsync(requestBody);