Mark all your Chat Messages in Microsoft Teams as ‘Read’ through PowerShell

Featured image

In Microsoft Teams, in current world, it’s really a painstaking effort to mark your 1:1 chats as Read, especially when you have hundreds of them which have accumulated over your busy routine.

In this blog, you can find out how easily you can mark all your Personal Chat Messages as Read in a single shot, through PowerShell.

This script uses the built-in function ‘MgMarkChatReadForUser’ to iterate over the chats and get them marked as read.

Let’s get started!

Pre-requisites : Please install the Microsoft Graph PowerShell module before running this script.

All you need to do is :

  1. Execute the below script with the User UPN as parameter.
  2. Sign-in as the user whose chats to be marked as read.

Note : Please make sure you sign-in as the same user whose UPN you have provided as the parameter for the script.

function Read-TeamschatMessage
     param (  
        Import-Module Microsoft.Graph.Teams  

        Connect-MgGraph -Scopes "Chat.ReadWrite" ,"User.Read"

        #To Get Tenant Id
        $Tenant= Get-MgOrganization 

        $TenantId= $Tenant.Id

        $Chats =Get-MgUserChat -UserId $UserUPN -ExpandProperty "members" 

        $User = $Chats[0].Members | Where-Object {$ -eq $UserUPN} | select AdditionalProperties

        $UserId = $User.AdditionalProperties.userId

        foreach($chat in $Chats)
            $params = @{

                User = @{
                    Id = $UserId
                    tenantId = $TenantId

            Invoke-MgMarkChatReadForUser -ChatId  $chat.Id -BodyParameter $params 


Read-TeamsChatMessage -UserUPN "<User UPN>"

# For example
# Read-TeamsChatMessage -UserUPN ""     

About Apps4.Pro Migration Manager

Apps4.Pro Migration Manager is the leading migration tool available in the market with unique migration features such as Teams chat, SharePoint and Teams Wiki, Stream, and Yammer, Forms, Power Platform migration. The app is available for 15 days free trial. To seek the free trial, please visit :

To surf through the frequently asked questions, please visit the Support Portal

Write to us at to know more.