次の方法で共有


Add media attachments to messages the v3 C# SDK

APPLIES TO: SDK v3

A message exchange between user and bot can contain media attachments (e.g., image, video, audio, file).

The Attachments property of the Activity object contains an array of Attachment objects that represent the media attachments and rich cards within to the message.

Add a media attachment

To add a media attachment to a message, create an Attachment object for the message activity and set the ContentType, ContentUrl, and Name properties.

replyMessage.Attachments.Add(new Attachment()
{
    ContentUrl = "https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png",
    ContentType = "image/png",
    Name = "Bender_Rodriguez.png"      
});

If an attachment is an image, audio, or video, the Connector service will communicate attachment data to the channel in a way that enables the channel to render that attachment within the conversation. If the attachment is a file, the file URL will be rendered as a hyperlink within the conversation.

Additional resources