Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Demonstrates adding a domain to the list of allowed domains across multiple SharePoint sites (useful for the Embed webpart)
$SiteUrls = @("HR","Accounting","IT")
foreach($SiteUrl in $SiteUrls) {
Write-Host -ForegroundColor Cyan "Applying to $SiteUrl..."
$FullSiteUrl = "$SiteUrl"
Connect-PnPOnline $FullSiteUrl -ErrorAction Stop
$site = Get-PnPSite -Includes CustomScriptSafeDomains
$ctx = Get-PnPContext
$ssDomain = [Microsoft.SharePoint.Client.ScriptSafeDomainEntityData]::new()
$ssDomain.DomainName = ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment