I've been trying to put Teams channel to eDiscovery Hold(both mailbox and sharepoint) using PowerShell but I'm stuck so I would be really appreciated if I can get any help or suggestion on how to proceed with my script.
Basically the idea is, I will provide the either Private or Public Team Channel name at the begining of the script and it'll put everything on eDiscovery hold.
$UserEmail = "username@nam.com"
Connect-MicrosoftTeams
Get-Team -user $UserEmail
$Mailbox = Get-Mailbox | Where {$_.PrimarySmtpAddress -eq $UserEmail}
Get-UnifiedGroup | Where {(Get-UnifiedGroupLinks $_.Alias -LinkType Members).DistinguishedName -contains $mailbox.DistinguishedName}
Get-UnifiedGroup | select DisplayName, SharePointSiteUrl
Get-MailboxFolderStatistics -Identity "Office 365 Sandbox" -FolderScope ConversationHistory -IncludeOldestAndNewestItems | ?{$_.FolderType -eq "TeamChat"} | Format-Table Name, ItemsInFolder, NewestItemReceivedDate
Set-Mailbox -Identity "Office 365 Sandbox" -LitigationHoldEnabled $True -GroupMailbox