SPOL : Access Denied when you upload a custom css on the Style Library

 In the modern SPOL, when you try to upload a custom css file, you end up getting an error like this. 



This is related to the No script setting in Modern Sites, you may need to use the below PS snippet to turnoff NoScript on the Modern Site.


Connect-SPOService -Url https://<tenantname>-admin.sharepoint.com
Set-SPOSite -Identity https://<SiteUrl> -DenyAddAndCustomizePages 0


One other way of doing this is to inject using one of the SPFX PnP widget - https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-add-js-css-ref


Comments

Popular posts from this blog

Email content to a document library (MOSS 2007)

Power Apps - Restricting the Text Box only Whole Numbers

Features - "You are not authorized to view this page" - Error 403