jbtamares
jbtamares

Reputation: 778

BotFramework - Logging Chat History for Prompt Dialogs

Do anyone knows how am I going to access the rich cards using IActivityLogger? Cause right now I cannot log the rich card's properties (e.g. title) though I can access the content by using activity.AsMessageActivity().Attachments and access the attachments by using

foreach (var attachment in attachments)
{ 
   attachment.Content 
} 

but I do not know how am I going to access those rich card properties? Any way to do this? Thanks!

Upvotes: 0

Views: 81

Answers (1)

Ezequiel Jadib
Ezequiel Jadib

Reputation: 14787

By looking to the ContentType property of the attachment you will know what type of card the Attachment is.

After that is just a matter of casting the Content property to the card type.

For example:

// TODO: add switch logic to perform the corresponding cast depending the type of the card.
var heroCard = attachment.Content as HeroCard

The Content Types of the card are accessible via each of the cards:

HeroCard.ContentType

ThumbnailCard.ContentType

Upvotes: 1

Related Questions