Send code snippets in a message in Teams

To send a code snippet in a chat or channel message:

  1. Select Format Expand button below the message box.

  2. In the upper-right corner, select More options More options button .

  3. Choose Code snippet Code snippet button to open a dialog box.

    Send snippet

  4. In the dialog box, enter the code along with a title for the snippet. Select the check box if you want your text to wrap, and then select the pull-down menu to choose the language that you want to use.

  5. Select Cancel or Insert to add the snippet to your message.

    Snippet dialog box

Syntax highlighting and auto-indentation help you to write your code the way you want. When you send your snippet, it’s included in the message as a card, and the recipient can view it inline with the syntax highlighting intact.

To edit your code snippet after you’ve sent it, select More options More options button > Edit on your message, then Edit Edit button again on the snippet card.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×