How to send a stream video address in a message?

Contributor

Greetings,

I want send message Microsoft Stream video link.

In Teams App, paste the MS Stream Video address into the message entry window.

 

This image is automatically created.

image.png

 

I want to send this using Graph API.

 

I tried with attachment, but I failed with message that id is not present in body.

 

 var channel = await graphClient.Teams[pClassId].PrimaryChannel
               .Request()
               .GetAsync();

                
                var chatMessage = new ChatMessage
                {
                    Body = new ItemBody
                    {
                        ContentType = BodyType.Html,
                        Content = ""
                    },
                    Attachments = new List<ChatMessageAttachment>()
                    {
                        new ChatMessageAttachment
                        {
                            
                            ContentType = "reference",
                            ContentUrl = streamurl
                        }
                    }
                };
                

                resultChatMsg = await graphClient.Teams[pClassId].Channels[channel.Id].Messages
                    .Request()
                    .AddAsync(chatMessage);

 

 

How can I implement it?

Thank you for any help.

1 Reply