Posting code snippets to Microsoft Teams

image

If you want to post a snippet of code to Microsoft Teams go to the Conversations tab and then select the Format text icon as shown above.

image

From this expanded dialog box select the Code icon as shown.

image

This should display a new dialog like shown above.

image

If you select the options in the top right you will see a huge range of code selections displayed as shown.

image

In the above case, I have select PowerShell and you can see that it formats and colours the code snippet for me automatically making it much easier to read.

image

You can now post the result and that will be added to the Teams Conversations as shown above. You will see that it even automatically add line numbers, which is very handy.

Thus, if you are going to post code into Microsoft Teams Conversations, make sure you do it via the Format Text option so that it is formatted in a way that makes it more readable.

2 thoughts on “Posting code snippets to Microsoft Teams

  1. “it even automatically add line numbers, which is very handy” – it’s not handy at all because it starts them at 1 even if your snippet is at line 500 in the actual source file. The line numbers teams puts in are meaningless and confusing and you cannot even turn them off. Very poor

    Like

    1. I disagree. It is designed for casual short code snippets not 100’s of lines for developers. It is a feature that benefits many but clearly it will never benefit all.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s