Forum Discussion

Sai06's avatar
Sai06
Copper Contributor
Sep 08, 2022

Send chat message with attachment in teams channel

Trying to post chat message with attachment in teams channel using graph API. We are able to post the message successfully but when try to preview the attachment we are seeing a message please find the screenshot below. Please suggest a way to resolve this issue.

 

tried request to post using graph call:

POST https://graph.microsoft.com/v1.0/teams/{teamsId}/channels/{channelId}/messages 

 

{ 

    "body": { 

        "contentType": "html", 

        "content": "Test with Graph Attachment. <attachment id=\"{eTag}\"></attachment>" 

    }, 

    "attachments": [ 

        { 

            "id": "{eTag}", 

            "contentType": "reference", 

            "contentUrl": "{SPO Attachment URL}", 

            "name": "Test Versions.docx" 

        } 

    ] 

} 

    • Sai06's avatar
      Sai06
      Copper Contributor
      Hi Team,
      Any update on chat attachment issue?
      • Nivedipa-MSFT's avatar
        Nivedipa-MSFT
        Icon for Microsoft rankMicrosoft
        Sai06 - Have you used correct contentURL? Can you please hit that contentURL in browser and check the file is opening or not?

Resources