Chat Message Api not Working Properly

Dipika Das 141 Reputation points
2022-11-16T10:37:06.62+00:00

Hi,

I'm using SDK to call graph api and recently updated the version to latest which is 4.47. The problem is when I'm calling the message api i.e below I'm getting the result, but check the below attached images the object of EvenDetail that is returning as result and the one when I'm opening the Event Detail both are different .

var messages = await graphClient.Chats[{chat-Id}].Messages
.Request()
.GetAsync();

Image 1:

260922-eventdetail1.jpg

Image 2:

260916-eventdetail2.jpg

Image 3:
260895-eventdetail3.jpg
Can anyone help me on this ,am I missing something or else what is the actual issue?

Thanks in Advance

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vicky Kumar (Mindtree Consulting PVT LTD) 1,161 Reputation points Microsoft Employee
    2022-11-16T13:18:21.79+00:00

    This question is not specific to graph, but if you are trying to cast a list of objects to a single object. You'll need to get the class that implements that interface (IChatMessageHostedContentsCollectionPage), create a new instance of it, and add your list to whatever property on the page contains the items

    you can check similar question to related to how to cast objects - https://stackoverflow.com/questions/63939881/unable-to-cast-object-of-type-listmicrosoft-graph-chatmessagehostedcontent-to

    Hope this helps
    Thanks


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.