Tuesday, January 17, 2017

File upload failed to SharePoint Online Style Library

I was changing the look and feel of a SharePoint online Team Site. So I needed to upload a few CSS, JS and ASPX files. I tried through the browser and got the below error. “The documents cannot be uploaded because different permissions are needed. Request the necessary permissions.” At the same time I was trying through SPD as well. But the same result with a different error message “Access Denied”. These errors have nothing to do with the Site Collection / Site level permissions.

2

Well, Googling, I figured that enabling custom scripts in admin center will do the job. In your Office 365 admin center, go to SharePoint Admin Center and select Settings. There you will see the “Custom Script”, where you can enable it for personal sites and self-service created sites. But the catch is, it’s gonna take 24 hours to take effect.

1

The Custom Script feature enables or disables scripting capabilities on SharePoint Online personal sites and self-service sites. Because self-service site creation points to your tenant’s root site collection by default – you’re actually applying the scripting capability to your tenant’s root site collection. If you don’t want this and instead want to enable or disable scripting on another site collection, you can point the self-service site creation root to another valid site collection in Office 365.

To enable scripting on a particular site collection immediately, use the following PowerShell command
Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0

There’s a lot more info about it in the below url.
https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1F2C515F-5D7E-448A-9FD7-835DA935584F?ui=en-US&rs=en-US&ad=US&fromAR=1

1 comment:

Unknown said...

Thank you very much! It did the job!)

Had a problem of the same kind, when attempting to deploy Client-Side DAL Framework sample from PnP: https://github.com/SharePoint/PnP/tree/master/Samples/Portal.DataAccessLayer. Setting "Custom Scripts" to "Allow" resolved the issue in 12 hours.