Skip to content

Instantly share code, notes, and snippets.

Embed
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 = "https://superspecial.sharepoint.com/sites/$SiteUrl"
Connect-PnPOnline $FullSiteUrl -ErrorAction Stop
$site = Get-PnPSite -Includes CustomScriptSafeDomains
$ctx = Get-PnPContext
$ssDomain = [Microsoft.SharePoint.Client.ScriptSafeDomainEntityData]::new()
$ssDomain.DomainName = "special.hosted.panopto.com"
$site.CustomScriptSafeDomains.Create($ssDomain)
$ctx.ExecuteQuery()
Disconnect-PnPOnline
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment