Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Carousel in adaptive card

Please guide me to create carousel adaptive card in MS bot framework. I am using .Net sdk.I tried using adaptive card designer to design but couldn't do it.

like image 895
Joel Abraham Avatar asked Jan 10 '20 15:01

Joel Abraham


People also ask

Which component in Microsoft Teams does not support adaptive cards?

Media elements are currently not supported in Adaptive Card on the Teams platform.

How do adaptive cards work?

Adaptive Cards are a platform-agnostic method of sharing and displaying blocks of information without the complexity of customizing CSS or HTML to render them. You author Adaptive Cards in JSON format, with integrations that cloud apps and services can openly exchange.


Video Answer


1 Answers

Your question isn't really specific enough for me to understand where you are having trouble, but I can give you a basic outline of creating a card carousel. My code is nodejs but it should be similar enough to give you an idea.

You will need CardFactory and MessageFactory to generate first the cards and then the Carousel (which takes an array of cards as the input).

// First create an empty array for your carousel
var cardArray = [];

// Populate the array with your cards (can use any method, I used a for loop)
for (var idx = 0; idx < dataForCards.length; idx++) {
   // Create the adaptive card
   var adaptiveCard = CardFactory.adaptiveCard({

   // YOUR CARD DEFINITION HERE

   });
   // Push the card to the array for the carousel
   cardArray.push(adaptiveCard);
}
// Send the array as a carousel
await step.context.sendActivity(MessageFactory.carousel(cardArray));
like image 54
billoverton Avatar answered Sep 18 '22 16:09

billoverton