You can copy Teams chat content in Power Automate using the Microsoft Graph API. This API allows you to access data from various Microsoft services, including Teams.
Here's how to do it:
- Get the Chat ID: First, you need to identify the specific chat you want to copy. This can be done by either knowing the chat ID or by retrieving it using the Microsoft Graph API.
- Use the Microsoft Graph API: Once you have the chat ID, you can use the
GET /teams/{teamId}/channels/{channelId}/messages
endpoint to retrieve the chat messages. - Format the Data: The API will return the chat messages in JSON format. You can use Power Automate actions to parse and format the data into a more readable format, such as a table or a text file.
- Save the Chat Content: Finally, you can save the formatted chat content to a location of your choice, like a SharePoint document library or a cloud storage service.
Example:
{
"id": "19:[email protected]",
"createdDateTime": "2023-03-15T14:33:18.285Z",
"lastModifiedDateTime": "2023-03-15T14:33:18.285Z",
"subject": "Project Update",
"chatType": "channel",
"channel": {
"id": "19:[email protected]",
"displayName": "General"
},
"messages": [
{
"id": "19:[email protected]",
"createdDateTime": "2023-03-15T14:33:18.285Z",
"lastModifiedDateTime": "2023-03-15T14:33:18.285Z",
"from": {
"user": {
"id": "19:[email protected]",
"displayName": "John Doe"
}
},
"body": {
"content": "Project is on track."
}
}
]
}
This example shows a JSON response from the GET /teams/{teamId}/channels/{channelId}/messages
endpoint. It includes the chat ID, the channel information, and the messages within the chat.
Remember that you'll need to have the necessary permissions to access and copy Teams chat content using the Microsoft Graph API.