| description |
Automatically generated file. DO NOT MODIFY |
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChatMessage()
body := graphmodels.NewItemBody()
contentType := graphmodels.HTML_BODYTYPE
body.SetContentType(&contentType)
content := "Hello World <at id=\"0\">Jane Smith</at>"
body.SetContent(&content)
requestBody.SetBody(body)
chatMessageMention := graphmodels.NewChatMessageMention()
id := int32(0)
chatMessageMention.SetId(&id)
mentionText := "Jane Smith"
chatMessageMention.SetMentionText(&mentionText)
mentioned := graphmodels.NewChatMessageMentionedIdentitySet()
user := graphmodels.NewIdentity()
displayName := "Jane Smith"
user.SetDisplayName(&displayName)
id := "ef1c916a-3135-4417-ba27-8eb7bd084193"
user.SetId(&id)
additionalData := map[string]interface{}{
"userIdentityType" : "aadUser",
}
user.SetAdditionalData(additionalData)
mentioned.SetUser(user)
chatMessageMention.SetMentioned(mentioned)
mentions := []graphmodels.ChatMessageMentionable {
chatMessageMention,
}
requestBody.SetMentions(mentions)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
messages, err := graphClient.Teams().ByTeamId("team-id").Channels().ByChannelId("channel-id").Messages().Post(context.Background(), requestBody, nil)