編輯

共用方式為


Message formatting for bots

Important

This article is based on the v3 Bot Framework SDK. If you are looking for current documentation version 4.6 or later of the SDK, see the conversational bots section.

You can set the optional TextFormat property to control how your message's text content is rendered.

Microsoft Teams supports the following formatting options:

TextFormat value Description
plain The text should be treated as raw text with no formatting applied at all.
markdown The text should be treated as Markdown formatting and rendered on the channel as appropriate; see Formatting text content for supported styles.
xml The text is simple XML markup; see Formatting text content for supported styles.

Formatting text content

Teams supports a subset of Markdown and XML (HTML) formatting tags.

The following limitations apply:

  • Text-only messages don't support table formatting.
  • Rich cards support formatting in the text property only, not in the title or subtitle properties.
  • Rich cards don't support Markdown or table formatting.

Cross-platform support

To ensure that your formatting works across all platforms supported by Teams, be aware that some styles aren't supported across all platforms.

Style Text-only messages Rich cards (XML only)
bold ✔️️
italic ✔️ ✔️
header (levels 1–3) ✔️
strikethrough ✔️
horizontal rule
unordered list ✔️
ordered list ✔️
preformatted text ✔️ ✔️
blockquote ✔️ ✔️
hyperlink ✔️ ✔️
image link ✔️

Support by individual platform

Support for text formatting varies by type of message and by platform.

Text-only messages

Style Desktop iOS Android
bold ✔️ ✔️ ✔️
italic ✔️ ✔️ ✔️
header (levels 1–3)
strikethrough ✔️ ✔️
horizontal rule
unordered list ✔️
ordered list ✔️
preformatted text ✔️ ✔️ ✔️
blockquote ✔️ ✔️ ✔️
hyperlink ✔️ ✔️ ✔️
image link ✔️ ✔️ ✔️

Cards

For more information, see Card Formatting for support in cards.