Reporting Services w.SharePoint 2013 (SafeControls)

We’ve faced a problem with a SharePoint 2010->SharePoint 2013 upgrade, with regard to the display of SharePoint Reporting Services WebParts.

After installing the SSRS Add-In for Integrated mode, we still had an error :

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type Microsoft.ReportingServices.SharePoint.UI.WebParts.ReportViewerWebPart, Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91 could not be found or it is not registered as safe.

This is due to the components from SQL Server 2008 – it’s the v10 DLL.

From a quick look into the WEB.CONFIG, there is a SAFECONTROLS entry for the new v11 Reporting Services WebPart (as part of SQL Server 2012) – AND – also a BINDING REDIRECT for the v10 –> v11 DLL (assembly).

BUT – there isn’t a SafeControls entry – doh !

There was a blogpost about needing to manually add to WEB.CONFIG – no, thanks !

I have SIX web-app’s – and FIVE server’s in the farm – so that would be 30 changes.   AND – that’s for DEV, let alone TEST and PROD.

My resolution (drumroll) was to define a SPWebConfigModification – unfortunately, there were lots of examples in C# – but none using PowerShell.

So – here’s the script to do – just need to run ONCE for each WebApp that needs the fix.

Let me know if this helps you – it was a good ‘win’ for our team :

Add-PsSnapin Microsoft.SharePoint.PowerShell

# USAGE :AddToSafeControls_SSRSv10 -webUrl http://portal

# <SafeControl Assembly=”Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91″ Namespace=”Microsoft.ReportingServices.SharePoint.UI.WebParts” TypeName=”*” Safe=”True” />

$safeControlsConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
$safeControlsConfig.Path = “/configuration/SharePoint/SafeControls”
$safeControlsConfig.Name = “SafeControl[@Assembly=’Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91′][@Namespace=’Microsoft.ReportingServices.SharePoint.UI.WebParts’][@TypeName=’*’][@Safe=’True’]”
$safeControlsConfig.Value = “<SafeControl Assembly=’Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91′ Namespace=’Microsoft.ReportingServices.SharePoint.UI.WebParts’ TypeName=’*’ Safe=’True’ />”
$webApp = Get-SPWebApplication $webUrl

Write-Host “Finished Updating web.config.”
Remove-PsSnapin Microsoft.SharePoint.PowerShell

One thought on “Reporting Services w.SharePoint 2013 (SafeControls)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s