Sending Teams message with attachment works with any attachment ID

scottwtang 1 Reputation point
2022-05-24T15:32:56.123+00:00

When using the Graph API to send a Teams message, as seen in example 4 in the documentation, the documentation notes that the attachment ID should be the eTag GUID of the driveItem.
However, I've successfully sent a HTTP request as below, using the attachment ID as 12345678-1234-1234-1234-123456789123 (without changing). It seems any attachment ID works

URI

https://graph.microsoft.com/v1.0/chats/19:00000000-0000-0000-0000-10b6e04b39b9_8388322d-0000-0000-0000-7401c360f83f@unq.gbl.spaces/messages  

Method

POST  

Headers

Authorization: Bearer {access_token}  
Content-type: application/json  

Body

{  
    "body": {  
        "contentType": "html",  
        "content": "Test message <attachment id=\"12345678-1234-1234-1234-123456789123\"></attachment>"  
    },  
    "attachments": [  
        {  
            "id": "12345678-1234-1234-1234-123456789123",  
            "contentType": "reference",  
            "contentUrl": "https://domain.sharepoint.com/Shared%20Documents/test.xml",  
            "name": "test.xml"  
        }  
    ]  
}  
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,485 questions
0 comments No comments
{count} votes