How to add html link element with a image in a Teams Chat message POST with body of contentType="html"

ArmbrusterMarkus-4875 0 Reputation points
2024-09-30T12:10:42.38+00:00

MS graph API is used to POST chat message with contentType="html" to Teams channel -> https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http

Requirement is to add a link element to the message which has a image (which is included in the chat message) and a text.

  1. base64 encoded inline images are not displayed in the chat message
<a href="https://..."><span><img src="data:image/png;base64,..." />Some text</span></a>
  1. image added as hostedContents are not displayed if image is a child element of a link
<a href="https://..."><span><img src="../hostedContents/1/$value" /> Some text</span></a>
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,268 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,226 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ArmbrusterMarkus-4875 0 Reputation points
    2024-10-01T14:07:49.5833333+00:00

    Hi @JimmyYang-MSFT

    Thank you for adding Teams development tag to address this issue to the development team.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.