Export Microsoft Teams chat messages for a given user, or a team.
Options
Option
Description
--userId [userId]
The Id of the user whose messages are to be exported. Specify either userId, userName or teamId
--userName [userName]
The UPN of the user whose messages are to be exported. Specify either userId, userName or teamId.
--teamId [teamId]
The Id of the team of which the messages are to be exported. Specify either userId, userName or teamId.
--fromDateTime[fromDateTime]
The start of time range to query
--toDateTime[toDateTime]
The end of time range to query
-l, --licenseModel [licenseModel]
License requirements are applicable on the protected Teams export API. Allowed values are modelA, modelB, evaluation. The default is evaluation. Read more about the license requirements.
-a, --withAttachments
When specified, the command will also download all chat attachments. Use folderPath as well to set the rootfolder.
-p, --folderPath [folderPath]
The folder path to save downloaded attachments to when using withAttachments.
Remarks
Microsoft Teams APIs in Microsoft Graph that access sensitive data are considered protected APIs. Export APIs require that you have additional validation, beyond permissions and consent, before you can use them. To request access to these protected APIs, complete the request form
Usage
m365 teams message export [options]
Description
Export Microsoft Teams chat messages for a given user, or a team.
Options
--userId [userId]
userId
,userName
orteamId
--userName [userName]
userId
,userName
orteamId
.--teamId [teamId]
userId
,userName
orteamId
.--fromDateTime[fromDateTime]
--toDateTime[toDateTime]
-l, --licenseModel [licenseModel]
modelA
,modelB
,evaluation
. The default is evaluation. Read more about the license requirements.folderPath
as well to set the rootfolder.-p, --folderPath [folderPath]
withAttachments
.Remarks
Microsoft Teams APIs in Microsoft Graph that access sensitive data are considered protected APIs. Export APIs require that you have additional validation, beyond permissions and consent, before you can use them. To request access to these protected APIs, complete the request form
Additional Information
https://docs.microsoft.com/en-us/microsoftteams/export-teams-content#how-to-access-teams-export-apis
Prerequisites to access this API
https://docs.microsoft.com/en-us/microsoftteams/export-teams-content#prerequisites-to-access-teams-export-apis