Skip to content

Set-SiteDesign

SharePoint Online: Updates a site design

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Identity,
    [string]$Title,
    [ValidateSet('Team site template','Communication site template')]
    [string]$WebTemplate,
    [string]$Description,
    [switch]$IsDefault,
    [string]$PreviewImageAltText,
    [string]$PreviewImageUrl
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; Identity = $Identity }
        if ($WebTemplate -eq 'Team site template') { $cmdArgs.Add('WebTemplate', '64') }
        elseif ($WebTemplate -eq 'Communication site template') { $cmdArgs.Add('WebTemplate', '68') }
        if ($PSBoundParameters.ContainsKey('Title')) { $cmdArgs.Add('Title', $Title) }
        if ($PSBoundParameters.ContainsKey('Description')) { $cmdArgs.Add('Description', $Description) }
        if ($PSBoundParameters.ContainsKey('IsDefault')) { $cmdArgs.Add('IsDefault', $IsDefault) }
        if ($PSBoundParameters.ContainsKey('PreviewImageAltText')) { $cmdArgs.Add('PreviewImageAltText', $PreviewImageAltText) }
        if ($PSBoundParameters.ContainsKey('PreviewImageUrl')) { $cmdArgs.Add('PreviewImageUrl', $PreviewImageUrl) }
        $result = Set-SPOSiteDesign @cmdArgs | Select-Object *
        if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
    }
    catch { throw }
}

The site design ID

Display name of the site design

Base template: Team site template or Communication site template

Display description of the site design

Off

Apply the site design to the default site template

Alt text description of the preview image

URL of a preview image

An interactive directory of PowerShell scripts.