We received confirmation from Microsoft Support that this is indeed a bug. The hostedContents
endpoint should not return a null ID. This was caused by an issue on Microsoft's side. A fix for the issue has been pushed to production, but any earlier messages with the malformed and illegal nullid
are not being retrospectively fixed.
Issue with Microsoft Teams Graph API: Null ID in hostedContents Response
I'm encountering an issue with the Microsoft Teams Graph API when attempting to retrieve hosted content for a Teams message. Specifically, the hostedContents
endpoint returns a null ID, which leads to a "Bad Request" error when trying to access the content using that ID. Below are the details of the requests and responses.
Request 1: Retrieve hostedContents
GET /v1.0/teams/[team-id]/channels/[channel-id]/messages/[message-id]/hostedContents HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer [token]
Response:
HTTP/1.1 200 OK
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('[team-id]')/channels('[channel-id]')/messages('[message-id]')/hostedContents",
"@odata.count": 1,
"value": [
{
"id": "aWQ9LHR5cGU9MSx1cmw9aHR0cHM6Ly9b...redacted-external-url...]",
"contentBytes": null,
"contentType": null
}
]
}
Observation: The id
field decodes to id=,type=1,url=[external-url]
, indicating a null id
value.
Request 2: Access hosted content using the provided ID
GET /v1.0/teams/[team-id]/channels/[channel-id]/messages/[message-id]/hostedContents/aWQ9LHR5cGU9MSx1cmw9aHR0cHM6Ly9b...redacted-external-url...].jpg/$value HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer [token]
Response:
HTTP/1.1 400 Bad Request
{
"error": {
"code": "BadRequest",
"message": "Provided hosted content identifier is invalid.",
"innerError": {
"date": "2025-04-21T05:08:18",
"request-id": "[request-id]",
"client-request-id": "[client-request-id]"
}
}
}
Context
The message in question contains an external URL (e.g., a YouTube thumbnail). The hostedContents
endpoint successfully returns metadata, but the id
field is null, which causes the subsequent request to fail with the error "Provided hosted content identifier is invalid."
Questions
- Is it expected behavior for the
hostedContents
endpoint to return a nullid
(i.e.,id=
in the encoded response) when the content is an external URL? - If a null
id
is expected, how should applications handle this case to retrieve the content? For example, should they fall back to theurl
field or skip the content? - If a null
id
is not expected, is this a bug in the Graph API, and are there any known workarounds?
Additional Notes
- The requests are made using a valid bearer token with appropriate permissions.
- The issue appears specific to messages with external content, as other message types process correctly.
- Any relevant documentation or guidance on handling
hostedContents
for external URLs would be greatly appreciated.
Thank you for your assistance!
Microsoft Security | Microsoft Graph
1 answer
Sort by: Most helpful
-
Marcus Rowell 1 Reputation point
2025-06-26T02:09:16.5433333+00:00