O365 - Enabling Custom Script Web Parts For Self-Service Created Sites

We had a requirement from one of our IT managers to collaborate with his team leads and to maintain the SLAs for all his team in a SharePoint site.

So, we decided to create a team using Microsoft Teams for him to collaborate and use the Self-Service created SharePoint Online site to create required lists to maintain and show the SLAs.

One of the requirements required us to add a content editor web part in a page to add some JavaScript and guess what, these basic web parts were not available in these sites. Other team sites created directly through the Tenant’s SharePoint Admin portal have these web parts, but none of the sites created by MS Teams has them.

NoWebParts

Oops… Where are the web parts?

Then, we realized that at tenant level there are 2 settings that we need to enable in SharePoint Admin Center. You will find these options in:

  1. $Password="{password}"  
  2. $UserName="{tenantAdminAccountUserName}"  
  3. $SiteUrl="https://{tenantname}-admin.sharepoint.com"  
  4. $PasswordAsSecure = ConvertTo-SecureString $Password -AsPlainText -Force  
  5. $Credentials = New-Object System.Management.Automation.PSCredential ($UserName , $PasswordAsSecure)  
  6. Connect-SPOService -Url $SiteUrl -Credential $Credentials  
  7. Set-SPOsite https://{tenantname}.sharepoint.com/sites/{sitecollurl} -DenyAddAndCustomizePages 0  

 

SharePoint Admin Center -> Settings ->

Settings

This clearly says, we need to wait for 24 hours for the change to take effect, but we didn’t wait this long as the settings were already enabled in our tenant.

Now, the question was, why we are not seeing these web parts then??

We found that these settings only mean that you will now be allowed to enable scripting web parts at each site collection level using the below power shell script, and it doesn’t make them available by default.

Well, this worked and we got the scripting web parts. Also, we found that in the list settings options like “Save list as template” are not available by default on the self-service created sites. Doing this makes them be available too.

YesWebParts.PNG

Not sure why Microsoft did this or why it is not documented anywhere. I think, they just want to give us some challenges.

G
M
T
 
Text-to-speech function is limited to 200 characters