Forum Discussion
How to embed large text blocks in a chat message
I am trying to include a large-ish code snippet in a Teams message.
I understand that the message itself can only be so many characters, but is there a way to create an ad-hoc object to place a larger text chunk in, rather than save my content to a file and attach the file?
2 Replies
Microsoft Teams doesn’t really let you include very large text blocks or long code snippets directly in a chat message. You can use the code block formatting (with three backticks ``` or the “Code snippet” option in the message toolbar) for shorter pieces, but it has limits. If your text is too long, the easiest workaround is to save it as a text file and attach it, or paste it into a shared OneDrive or SharePoint file and link to it. Some people also use tools like GitHub Gist or Pastebin for larger snippets and just share the link in Teams. It’s not perfect, but it keeps your message clean and makes it easier for others to read or copy your content.
------------------------------------
Don't forget to mark as solution if my answer suits you- ErichZimmermanCopper Contributor
Thank you!
I completely understand the reasoning behind not allowing to paste large text blocks into a message, and creating a separate file to attach is fine.
Some other tools allow you to create such "attachments" inline, if you will. Basically, you would click "Add +", and select "text snippet" or "code snippet", which you could then paste in your block. It still appears as an attachment or a minimized block in the message, but you don't have to do the external work.