Pages

Tuesday 11 February 2014

Html Field Security in SharePoint 2013 using PowerShell

SharePoint 2013 now comes with a feature known as "HTML Field Security". Through this feature a site collection administrator can control what content is allowed to embed within the iframe. It can restrict what contributors can embed in site pages.
Here an administrator can define the domain names from which a contributor can add contents.
Below is Powershell script to add domain names in "HTML Field Security".

The key method of powershell which performs this operation is:
$web.ScriptSafeDomains.Add("DomainToAllow.com")


Here is Script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
cls
$personalwebs= Get-SPSite -WebApplication http://someurlhere/ -Limit All | Where-Object { $_.Url -match "Condition_here/*"}

foreach($web in $personalwebs)
{       
        $web.ScriptSafeDomains.Add("DomainToAllow.com")

}

No comments:

Post a Comment