Skip to content

Get-MgmtGraphGroupConversationThreadCount

MgmtGraph: Retrieves the count of threads in a conversation

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Groups

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$GroupId,

    [Parameter(Mandatory = $true, Position = 1)]
    [string]$ConversationId
)

Process {
    try {
        $params = @{
            'GroupId'        = $GroupId
            'ConversationId' = $ConversationId
            'ErrorAction'    = 'Stop'
        }

        $count = Get-MgGroupConversationThreadCount @params
        
        $result = [PSCustomObject]@{
            GroupId               = $GroupId
            ConversationId        = $ConversationId
            ConversationThreadCount = $count
            Timestamp             = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

The unique identifier of the Microsoft Graph group.

The unique identifier of the target conversation.

An interactive directory of PowerShell scripts.