SharePoint Online - O365: How to enable script editor web part in SharePoint online

In just 2 commended steps Instantly enable script editor web part in SharePoint online

No comments

Loading

Enable script editor web part in SharePoint online – in this article, we will learn In just 2 commended steps Instantly enable script editor web part in SharePoint online. a few days back one of my colleagues reported to me that he is not finding the script editor web part on SharePoint online site. After some analysis, we learned that on SharePoint online site script editor web part is not available by default. In order to make it available, we need to enable the custom script from the SharePoint Tenant admin center. Here, in this article, I will explain how to enable this.

Verify that the script editor web part is not available by default: Script Editor web part not showing SharePoint Online

Navigate to the edit your web part page – > Insert -> Web Part -> Categories ->Media and Content

Here we can see that the “Script Editor” web part is missing. Not only that we can not see also the “Content Editor” web part and many more. Please see the below screenshot:

Script editor web part is missing under Media and Content in SharePoint Online
The script editor web part is missing under Media and Content in SharePoint Online

Now go to your tenant setting page thru this URL

https://sprnd-admin.sharepoint.com/_layouts/15/online/TenantSettings.aspx

Note: Here “sprnd” is my tenant name, you need to pass your tenant name.

Now see the “Custom Script” section by default both the radio button is selected as prevent – this is the default behavior and due to this script editor and content editor web part is missing from SharePoint online page.

  1. Prevent users from running custom script on personal sites.
  2. Prevent users from running custom script on self-service created sites)
Prevent users from running custom script on personal sites in SharePoint Online
Prevent users from running custom script on personal sites in SharePoint Online

 

Now select to allow users to run the custom script for both the radio button as below:

  1. Allow users from running custom script on personal sites.
  2. Allow users from running custom script on self-service created sites)
Allow users from running custom script on personal sites in SharePoint Online
Allow users from running custom script on personal sites in SharePoint Online

 

Now click on ok and once you save it, this may take 24 hours to reflect the changes – this is what the message says from Microsoft but this was not correct at least for us. We had waited for around 3 days but still didn’t see the script editor web part on my page.

Then what to do?

Enable the custom scripting using the PowerShell script

To overcome this issue run the below PowerShell script – this will immediately add the script editor and content editor web part in the web part category.  This is the reason to write and share this article.

$adminUserID="youradminaccount@< sprnd.onmicrosoft.com>"

$userCredential = Get-Credential -UserName $adminUserID -Message “Enter password”

Connect-SPOService -Url https://sprnd-admin.sharepoint.com/ -Credential $userCredential

Set-SPOsite "https://sprnd.sharepoint.com/sites/TestSite001" -DenyAddAndCustomizePages 0

Notes:

  1. It should be your tenant domain account and your actual site.
  2. Here I have used my test trial tenant site.
  3. In Connect-SPOService pass your tenant admin URL
  4. In Set-SPOsite pass the site URL where you want to add the script editor web part.
  5. If your tenant admin account has MFA (multi-factor authentication) enabled, you cannot execute this – to execute this script use the account which does not have MFA enabled.

Verify that the script editor web part is available after executing the PowerShell Script: Enable script editor web part in SharePoint online

After executing the above script – immediately come to the same page – wow we can see the script editor, content editor, and many other web parts that were not there before the script execution under “Categories”:

Script editor web part is available in SharePoint Online
Script editor web part is available in SharePoint Online

Why does Microsoft not allow to add the script editor web part by default (script editor web part in SharePoint online)?

Considering the utmost security – Microsoft does not recommend adding the custom script to the page. If we want to add any custom scripting to our SharePoint online page – we need to add these out thru the SPFx framework.

Summary: Enable script editor web part in SharePoint online

Thus, in this article, we have learned about how to enable the script editor web part in SharePoint online.

See Also: SharePoint Online Tutorial

You may also like the below SharePoint Online tutorials:

Download SharePoint Online PDF Book

Download SharePoint Online & Office 365 Administration eBook

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:



Buy SharePoint Online & Office 365 Administration eBook


 

Get the free demo PDF eBook from here:

FREE DOWNLOAD

Send download link to:

Subscribe to get exclusive content and recommendations every month. You can unsubscribe anytime.

About Post Author

Do you have a better solution or question on this topic? Please leave a comment