Brand Logo
  • Home
  • Articles
  • AI Agents for SMB
  • Free Stuff
    • Copilot Tips Guide 🆕
    • Free JSON Formatting Mini-Guide
    • Code Samples
  • SharePoint Training
  • About
    • Coaching
  • Home
  • Articles
  • AI Agents for SMB
  • Free Stuff
  • SharePoint Training
  • About

Updates To Custom Scripting In SharePoint Online

Posted on July 3, 2024

New options are rolling out, and your tenant may already have them. The options control custom scripting, a feature that was previously only enabled and disabled via PowerShell.

What is custom scripting?

Custom scripting gives users a way to change the look and feel of sites. More importantly, it allows users to add custom JavaScript to a site. If you allow custom scripts, all users who have Add and Customize Pages permission to a site or page can add any script they want. (By default, users who create sites are site owners and therefore have this permission.)

Typically, you may be required to enable custom scripting on a site in order to add some 3rd-party web parts. You would also enable custom scripts to add JavaScript to a site.  That’s what I remember from my experience, anyways. While that’s less common of a requirement to see nowadays, it’s still important to know about. That’s more important now considering that Microsoft is making it very easy to control. 

Enabling and disabling custom scripts

Until recently, the only way admins could enable or disable custom scripting on a site was through PowerShell. This could be done either through SharePoint Online Management Shell:

Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 0

or through PnP PowerShell:

Set-PnPSite -Identity <SiteURL> -NoScriptSite $false

Either of these commands would enable custom scripting on a site.

Learn JSON Formatting from me

Learn More

Now there’s a MUCH easier way to control this, and it doesn’t even involve PowerShell. In the SharePoint Admin Center, you’ll find a new option when you select a site and view its properties.

On the Settings tab, you’ll see this new Custom scripts setting. This will easily let you change the setting, as seen on this screen, which appears after clicking the Edit button.

Notice the warning message that indicates the setting will revert to it’s normal value after 24 hours. That means that after enabling custom scripts, users will only have 24 hours to add the script they need to. After that point, they’ll be unable to add more scripts.

This lets you keep your sites secure while also allowing those power users who have scripting experience to customize their sites the way they prefer. In the past, the change was “sticky” and didn’t revert after some time elapsed. I think that Microsoft made a good decision to add this to the UI only after also introducing that auto-revert feature to keep sites as secure as possible.

I thought custom scripts were bad?

While it’s still considered bad practice to add custom JavaScript to a site this way (using SharePoint Framework is the preferred way), it’s better than having to deal with PowerShell. Not all administrators have PowerShell experience, and having this option in the UI makes their lives just a little bit easier.

Contact Me!

    Previous Post
    Section Backgrounds In SharePoint – Overdue or Overhyped?
    Next Post
    Microsoft is discontinuing this feature for SharePoint. Is it a mistake?

    Recent Posts

    Breaking Down The New SharePoint Knowledge Agent

    19 Sep at 7:32 am

    Copilot Agents Are Quietly Slashing IT Workloads. Here’s How

    10 Sep at 7:45 am

    AI for SMB: Real-World Wins Inside The Microsoft Ecosystem

    4 Sep at 6:50 am

    How To Delete SharePoint Agents

    26 Aug at 7:10 am

    How To Use The SharePoint FAQ Web Part With Copilot

    20 Aug at 7:55 am

    Keep Up With Microsoft

    Stay Ahead of SharePoint & M365 Copilot without the overwhelm.

    Book Recommendation
    Mastering Microsoft 365 and SharePoint Online: A complete guide to boosting organizational efficiency with Microsoft 365’s real-world solutions
    TikTok
    X
    LinkedIn
    YouTube
    *As an Amazon Associate I earn a commission from qualifying purchases.