Posting code snippets to Microsoft Teams


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.


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


This should display a new dialog like shown above.


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


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.


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


    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.


Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Connecting to %s