ArcGIS.Microsoft365.psm1
# Register-PnPManagementShellAccess # Connect-PnPOnline -Url https://m4o365.sharepoint.com # https://pnp.github.io/powershell/cmdlets/Add-PnPAlert.html function New-ArcGISTermSet { param() $EsriTermGroupName = "Esri" $EsriTermSetName = "ArcGIS" $OldEsriTermSetName = "M4SP" $TermGroups = Get-PnPTermGroup $HasEsriTermGroup = $false $HasEsriTermSet = $false Foreach ($TermGroup in $TermGroups) { if ( $TermGroup.Name -eq $EsriTermGroupName ) { $HasEsriTermGroup = $true } } # Create "Esri" term group if it is missing if (-not $HasEsriTermGroup) { New-PnPTermGroup -GroupName $EsriTermGroupName Start-Sleep -s 3 } $TermSets = Get-PnPTermSet -TermGroup $EsriTermGroupName Foreach ($TermSet in $TermSets) { if ($TermSet.Name -eq $EsriTermSetName) { $HasEsriTermSet = $true } # Rename existing "M4SP" term set(if any) to "ArcGIS" if ($TermSet.Name -eq $OldEsriTermSetName) { $HasEsriTermSet = $true Set-PnPTermSet -Identity $OldEsriTermSetName -TermGroup $EsriTermGroupName -Name $EsriTermSetName } } # Create "ArcGIS" term set if it is missing if (-not $HasEsriTermSet) { New-PnPTermSet -Name $EsriTermSetName -TermGroup $EsriTermGroupName } } Export-ModuleMember -Function New-ArcGISTermSet |