Search code examples
botframeworkmicrosoft-teamsadaptive-cards

Maximum Number of Adaptive Cards on Carousel - Microsoft Teams


In Microsoft Teams, what is the maximum number of adaptive cards that can be stacked on a carousel using Bot Framework? Is there any official docs on this?


Solution

  • I looked in the Bot Framework source code and didn't see anything that seems to limit the number of attachments you can attach to a message. This seems to indicate that any limitations would be based on the channel that's rendering the attachments and not based on the Bot Framework.

    The Attachments property is an IList<Attachment>. While Lists have 32-bit integer indexes, you're sure to run out of memory if you try to use int.MaxValue. I tried adding as many attachments as I could and the process seemed to get stuck at iteration number 8,115,461. Limiting it to 1,000,000 attachments, I was able to create the message but hit an exception when I tried to post it. With 100,000 attachments, I could get the message to send in the emulator but couldn't view the message in the inspector. With 10,000 attachments, I could see all of the attachments in the inspector but couldn't send the message in other channels once I published the bot.

    In the end it looks like 10 is the maximum number of Adaptive Card attachments you can have in a message sent through Microsoft Teams. Even if this limitation wasn't in place, I'd recommend not putting more than 10 attachments in a carousel anyway. There is some documentation here, but it seems to pertain to email messages and doesn't mention cards.