This article explains how to enable custom scripts for any SharePoint Online Site. There are quite a few articles on the Internet that explains how to enable custom script, so why am I writing this blog❓
Because there was a “Confusion” and a “Problem“.
On SharePoint Online Tenant we had custom script enabled, you can check this by Navigating to SharePoint Admin Centre(https://yoursharepointdomain-admin.sharepoint.com) ->Settings -> Custom Script-> The radio buttons should be set to ‘Allow Users to run custom script’.
One of the power-user added an App to this site-collection, which needed elevated privileges. The developer tried to elevate the App’s privileges numerous times but was not successful. He was banging this head against the wall. 😡
Navigate to site-settings for the newly created site-collection and compare the site-settings page with previous another site-collection. You will see that some of the features are missing e.g. Solution Gallery, Save Site as a template etc.
It should give you a hint (💡) that you need to enable Custom Script.
So how was this site-collection created? Any guesses?
The site-collection was created by -> clicking on the Office app launcher -> click SharePoint -> click Create Site Select Team Site from the option -> Enter the Site Name & Site description. It was a Modern SharePoint Online Team site.
- Install the SharePoint Online Management Shell by downloading and running the SharePoint Online Management Shell.
- Run SharePoint Online Management Shell with Elevated Privileges(Run as Administrator).
- Execute PowerShell commands against SharePoint online.
Connect-SPOService -URL https://yoursharepointdomain-admin.sharepoint.com
Set-SPOsite https://yoursharepointdomain.sharepoint.com/sites/sitecollection -DenyAddAndCustomizePages 0
All done.🙂 Now you should be able to elevate the Apps privileges and access advanced features.