Sunday 30 June 2019

SharePoint Online Allow custom scripts - Part 3

We have looked at why Microsoft disabled custom scripts in SharePoint Online and where it affects. We have looked in previous two blogs why and what is alternative. If you have not gone through that, please check below links.




In this post, we are going to review how to enable custom scripting on site collection level and what will be its impact.

So if we enable scripting at tenant level we may end up loosing control over security. Instead Microsoft Provided a way to enable scripting at site collection level.

Prerequisite:


  • SharePoint Online Management Shell 


Follow below steps to enable scripting at site collection level:

  • Open the SharePoint Online Management Shell console. 
  • Execute the command to connect the Office 365 :

    Connect-SPOService -Url https://tenant-admin.sharepoint.com
  • Execute the command bellow with the url for the site collection where you want to enable scripting:

    Set-SPOSite -Identity https://tenant.sharepoint.com/sites/contoso -DenyAddAndCustomizePages 0


Pros:


  • Tenant level scripting enable may take up to 24 hours. But this approach disable the scripting block immediately. 
  • As this settings are enabled at specific site collection, you can make sure the scripting do not affect other site collections or tenant.

Conclusion:

We have seen limitations and how to overcome that. If you need to enable scripting, choose the settings as per your need.

2 comments: