Reputation: 9806
The endpoint for retrieving hosted content bytes for an image is
GET https://graph.microsoft.com/beta/chats/{id}/messages/{id}/hostedContents/{id}/$value
However, the id
for hostedContents
items is Base64 encoded. For those id
s that contain a slash (/
), the request fails with 400. Encoding the slash as %2f
also fails with 400. Switching the slash to _
or -
results in 404.
How can I retrieve hostedContents
bytes for an image when the id contains a slash?
Upvotes: 2
Views: 674
Reputation: 997
In order for this to work you will need to double encode and use %252F
instead when dealing with the Microsoft Graph API:
encodeURIComponent(string).replace(/%2F/g, "%252F");
This should work for any value that has a /
including ID's.
I go into a bit more detail on this Github issue (to get the docs fixed):
https://github.com/microsoftgraph/microsoft-graph-docs/issues/10167
Upvotes: 3