Wednesday, April 13, 2016

Fix problem with ScriptEditorWebPart not available for contributors in Sharepoint sites

By default in Sharepoint users with Contribute permissions are not able to use scripting web parts. This is done because of security reasons, because otherwise regular contributors would be able to add e.g. ScriptEditorWebPart on the page and execute any javascript code on the page. This is how Media and Content web parts look like for contributors in this case:

As you can see neither ScripEditor nor ContentEditor web parts present here. At the same site users with Full control or Manage hierarchy permissions may add these web parts on the page:

However sometimes it is necessary to enable scripting web parts also for contributors. Fortunately in Sharepoint it is possible to enable this functionality for users with Contribute permissions. For on-premise Sharepoint steps are described in the following Technet article: Allow or prevent Contributors ability to edit scriptable Web Parts. You need to go to Central administration > Manage web applications > Select your web application and in the ribbon under Security category click Web part security:

Then under Scriptable web parts select “Allows contributors to add or edit scriptable Web Parts” option:

For Sharepoint Online it is also possible to enable scripting web parts for contributors using the following instructions: Turn scripting capabilities on or off. As it says, scripting capabilities are disabled by default for:
  • Personal sites
  • Self-service created sites
  • The Root Site Collection of the Tenant

In admin center it is possible to enable scripting capabilities for the personal and self-service created sites:

For enabling this possibility on other site collections you need to execute the following PowerShell script:

Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0

But it should match to the settings specified in admin center, otherwise it will be overridden within 24h (admin center settings have priority over PowerShell). Hope that this informat

No comments:

Post a Comment