Hi Nanda,
Yes, actually you can extract all the messages from a group chat & channel.
You can refer to this article https://learn.microsoft.com/en-us/graph/api/chatmessage-get?view=graph-rest-1.0&tabs=http. The messages can be extracted by using Ms Graph SDK, MS Graph Powershell or Ms Graph Explorer (use this for testing)
Here is an example to retrieve messages from channels
Steps:
- Open this link from browser https://developer.microsoft.com/en-us/graph/graph-explorer and sign-in using your m365 account
- Put this address https://graph.microsoft.com/v1.0/teams to the textbox and you may need to grant permission Team.ReadBasic.All from "Modify Permission" tab. Go run query and fetch the Id
- Replace the value in textbox with next calling to endpoint, https://graph.microsoft.com/v1.0/teams/{put team Id here}/channels and grant permission Channel.ReadBasic.All from "Modify Permission" tab. Go run query and fetch the Id
- Next, again replace the value in textbox with next calling to endpoint, https://graph.microsoft.com/v1.0/teams/{put team Id here}/channels/{put channel Id here}/messages and grant permission ChannelMessage.Read.All from "Modify Permission" tab. Go run query and you will get the message as below
- And to get the replied message, replace the value in textbox with next calling to endpoint https://graph.microsoft.com/v1.0/teams/{put team Id here}/channels/{put channel Id here}/messages/{put message Id here}/replies
Go run query and you will get the message as below
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".