Forum Discussion

eunderwo00's avatar
eunderwo00
Copper Contributor
Aug 14, 2024

Microsoft graph API method call to get content from content.body

I am writing a windows application that retrieves all messages and replies from MSTeams using the graphClient API using c#. I am using the method graphClient.Teams[TeamsID].Channels[ChannelID].Messages.GetAsync((requestConfiguration) to get the messages(not replies). I am trying to get (and store) the image embeded within the Body.Content return data. The end user is pasting the image within the message. Being said, it's not an attachment. The method I am trying to use to get the image data is

 

graphClient.Teams[TeamsID].Channels[ChannelD].Messages[MessageID(from previous method return data)].HostedContents[Content-ID].GetAsync();

 

I know what the Value of the TeamsId,ChannelID and MessageID. I do not know what the value is for the Content-ID. The Body.Content return data from the first API call contains data looking like the following.

 

"<p>Sep no jacket,&nbsp;&nbsp;no straps,&nbsp;&nbsp;weatherhead tied on</p>


<p><img alt="Media" src="https://graph.microsoft.com/v1.0/teams/02e7c74575f2/channels/x615tT4UI_UjDHEu1tx3mXiJ1wRtE1@thread.tacv2/messages/1723665375573/hostedContents/aWQ9LHR5cGU9MSx1cmw9aHR0cHM6Ly91cy1hcGkuYXNtLnNreXBlLmNvbS92MS9vYmplY3RzLzAtZXVzLWQxMS1hMGEyYTg4ZjhlNjlmN2RjZTFhYTE5YjIzNDM4Nzc1YS92aWV3cy9pbWdv/$value" width="1920" height="2560"></p>"

 

The item highlighted in red is the MessageID

I'm looking for some documentation as to what the parameter [Contend-ID] is. Searching for a solution always points me to getting the contents using the chat methodology. This is a message within a channel. 

No RepliesBe the first to reply