Set-MSTTeamArchivedState
Teams: Set the archived state of a team
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$GroupId,
[Parameter(Mandatory = $true)]
[bool]$Archived,
[bool]$SetSpoSiteReadOnlyForMembers
)
Process {
try {
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'GroupId' = $GroupId; 'Archived' = $Archived}
if ($PSBoundParameters.ContainsKey('SetSpoSiteReadOnlyForMembers')) {
$cmdArgs.Add('SetSpoSiteReadOnlyForMembers', $SetSpoSiteReadOnlyForMembers)
}
$result = Set-TeamArchivedState @cmdArgs | Select-Object *
if ($null -eq $result) {
$state = if ($Archived) { 'archived' } else { 'unarchived' }
Write-Output "Team $GroupId $state successfully"
return
}
$result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
}
catch { throw }
}GroupId of the team
Archived state (true to archive, false to unarchive)
Sets the SharePoint site to read-only for team members