Add-PorteoSiteDesigns.ps1
# # This file adds specific site scripts that are in the SiteScripts directory to the tennant site. # It then defines a set of Site Designs that will run the scripts. See below. # # Make sure you have a default connection to the tennant. # # Connect-PnPOnline -Url https://tennant.sharepoint.com -Credential (Get-Credential) # # This script need only be run once, but is idempotent, or will update in place. # function defineSiteScript { param( $title, $connection, [Switch] $force ) $content = (Get-Content "$PSScriptRoot/SiteScripts/$title.json" -Raw) return Add-SSPSiteScript -Title $title -Description "The $title" -Content $content -Force:$force -Connection $connection } function Add-PorteoSiteDesigns { param ( $type, $connection = (Get-PnPConnection), [Switch] $force ) Get-ChildItem -Path "$PSScriptRoot/SiteScripts" | Where-Object { defineSiteScript -Title $_.BaseName -Connection $connection -Force:$force } $scriptNames = ("DefaultBranding", "DefaultRegionalSettings", "DefaultSiteExternalSharingCapability", "DefaultTheme") Add-SSPSiteDesign -Title "DefaultDesign" -Type $type -SiteScriptIds $scriptNames -Connection $connection -Force:$force Add-SSPSiteDesign -Title "AddJournal" -Type $type -SiteScriptIds ("Journal") -Connection $connection -Force:$force Add-SSPSiteDesign -Title "AddLinks" -Type $type -SiteScriptIds ("Links") -Connection $connection -Force:$force Add-SSPSiteDesign -Title "AddRequests" -Type $type -SiteScriptIds ("Requests") -Connection $connection -Force:$force Add-SSPSiteDesign -Title "AddSiteLists" -Type $type -SiteScriptIds ("SiteCollectionList", "SubsitesList") -Connection $connection -Force:$force Add-SSPSiteDesign -Title "UseDarkBlueTheme" -Type $type -SiteScriptIds ("DarkBlueTheme") -Connection $connection -Force:$force Add-SSPSiteDesign -Title "SetLogo" -Type $type -SiteScriptIds ("SetLogo") -Connection $connection -Force:$force } |