Related topics
Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

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

  1. Select Format Expand button below the message box.

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

  3. 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.

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

    Screenshot showing expanded code snippet 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 Edit button on your message, then Edit Edit button again on the snippet card.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!