1

I have a survey list inside our communication online site, now using power-shell i have enabled custom scripting on the site Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0 one days ago, but when i edit the survey create list form i did not get the script editor web part, here what i got:-

enter image description here

any advice on this please? i want to add the script editor web part to add some styling to the survey create form..

0
0

Wait for 24 hours, check whether you can add script editor web part in other site.

Here is a similar issue post for your reference:

not able to see Content editor web part in communication site

1
  • I already did the changes around 30 hours ago – John John Apr 15 '20 at 10:43
0

In modern sharepoint that issue is not really new, a lot of updates happened including that piece.

I have a copy of the content editor .dwp webpart (ootb content editor webpart). Try uploading it (see your screenshot, just below the 'Search' at the bottom you can see the upload button) so it will show as one of the webpart options, it will show inside the 'Custom' tab.

SP Classic Content Editor Webpart

I'm assuming you knew content editor webpart, there you can insert a script, css, js, just make sure to enclose it with element tags so it will render as html piece.

sample for css implementation below,

<style type="text/css">.div{color: red}</style> 

paste you css scripts inside the content editor, then you're good to go.

Hope this concept helps, Happy Coding!

0

In the modern SharePoint online page - adding script editor web part is not recommended. We can add the script editor web part using the SPFx web part. In the GitHub, there is a modern script editor web part which we can install for the same purpose.

1: Clone or Download the repo:

You will have to clone this repo: https://github.com/SharePoint/sp-dev-fx-webparts or Directly download it from here: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-script-editor

  1. Edit the Write-manifests.json.

  2. Build the package

  3. Build the package and deploy

Demo Example:

Modern Script Editor Webpart

Source:

Add The Script Editor Web part back to SharePoint Modern Experience

Script editor web part for SharePoint Modern pages.

How to enable script editor web part in SharePoint online classic page?

First, enable the custom scripting from the admin center by following the below the navigation, then need to execute the PowerShell script - I had also faced this but with the combination of these two - got it fixed.

Go to your tenant setting page thru this URL

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

Note: Here “spend” 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.

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

Allow users from running custom script on personal sites. Allow users from running custom script on self-service created sites)

Allow Custom Script in SharePoint Online

This will not enable the custom script until we execute the below PowerShell Script.

$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

Once, we execute the above PowerShell script, immediately script editor will be available.

For details refer to the below article:

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

3
  • the setting on the admin center is for personal sites and self-service sites only, those are not suppose to effect modern communication site...as the communication modern site is not a self-service site nor a personal site – John John Apr 15 '20 at 13:23
  • Script editor web part in modern SharePoint page is not recommended - we can use the SPFx web part for that - there is already a developed web part in GitHub, just need to deploy, answer updated. – GSD - SharePoint Apr 15 '20 at 13:48
  • thanks for the update, but i am using survey list as mentioned in my question, and the Survey list has the classic UI, so i can not add the SPFx web part inside it....sorry your answer is not directly related to my question... – John John Apr 15 '20 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.