Quantcast
Channel: WSPBuilder (SharePoint WSP tool)
Viewing all articles
Browse latest Browse all 38

New Post: How can we set SafeAgainstScript attribute to true while adding SafeControl entries using WSPBuilder

$
0
0

Powershell to the rescue:

function SetSafeAgainstScriptTrue($url)
{$webapp= Get-SPWebApplication $url$path=$webapp.IisSettings.get_Item(0).Path.FullName +"\web.config"$now=[datetime]::now.ToString('yyyy-MM-dd')
	Copy-Item $path"$path.$now"
	Write-Host "Backupped"
	Write-Host "Modifying web.config file in path $path"
	(Get-Content $path) | 
		Foreach-Object {$_-replace"SafeAgainstScript=`"False`"", "SafeAgainstScript=`"True`""} | 
	Set-Content $path
}

Viewing all articles
Browse latest Browse all 38

Trending Articles