AdaptiveCard Class

Definition

An Adaptive Card, containing a free-form body of card elements, and an optional set of actions.

public class AdaptiveCard : Microsoft.Teams.Cards.CardElement
type AdaptiveCard = class
    inherit CardElement
Public Class AdaptiveCard
Inherits CardElement
Inheritance

Constructors

Name Description
AdaptiveCard()
AdaptiveCard(CardElement[])
AdaptiveCard(IList<CardElement>)

Properties

Name Description
Actions

The card level actions, which always appear at the bottom of the card.

Authentication

Defines authentication information to enable on-behalf-of single-sign-on or just-in-time OAuth. This information is used in conjunction with the refresh property and Action.Execute in general.

BackgroundImage

Defines the container's background image.

Body

The body of the card, comprised of a list of elements displayed according to the layouts property. If the layouts property is not specified, a Layout.Stack is used.

Fallback

An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.

FallbackText

The text that should be displayed if the client is not able to render the card.

GridArea

The area of a Layout.AreaGrid layout in which an element should be displayed.

Id

A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.

IsSortKey

Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements.

Key

Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application.

Lang

The locale associated with the element.

Layouts

The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See Container layouts for more details.

Metadata

Metadata associated with the card.

MinHeight
Msteams

Teams-specific metadata associated with the card.

Refresh

Defines how the card can be refreshed by making a request to the target Bot.

Requires

A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided).

Resources

Resources card elements can reference.

Rtl

Controls if the content of the card is to be rendered left-to-right or right-to-left.

Schema

A URL to the Adaptive Card schema the card is authored against.

SelectAction

An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported.

Speak

The text that should be spoken for the entire card.

Style

The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met.

Type

Must be AdaptiveCard.

Version

The Adaptive Card schema version the card is authored against.

VerticalContentAlignment

Controls how the container's content should be vertically aligned.

Methods

Name Description
Deserialize(String)

Deserializes a JSON string into an object of type AdaptiveCard.

Serialize()

Serializes this AdaptiveCard into a JSON string.

WithActions(Action[])
WithActions(IList<Action>)
WithAuthentication(Authentication)
WithBackgroundImage(IUnion<String,BackgroundImage>)
WithBody(CardElement[])
WithBody(IList<CardElement>)
WithFallback(IUnion<CardElement,FallbackElement>)
WithFallbackText(String)
WithGridArea(String)
WithId(String)
WithIsSortKey(Boolean)
WithKey(String)
WithLang(String)
WithLayouts(ContainerLayout[])
WithLayouts(IList<ContainerLayout>)
WithMetadata(CardMetadata)
WithMinHeight(String)
WithMsteams(TeamsCardProperties)
WithRefresh(RefreshDefinition)
WithRequires(HostCapabilities)
WithResources(Resources)
WithRtl(Boolean)
WithSchema(String)
WithSelectAction(Action)
WithSpeak(String)
WithStyle(ContainerStyle)
WithVersion(Version)
WithVerticalContentAlignment(VerticalAlignment)

Applies to