Site Collection Administrator access denied when adding solutions
I have recently found myself in a situation, when after creation of a new, Modern Site (it was a modern Team Site) my account, even though that was set to be a SharePoint Administrator (even a tenant one :)) and a Site Collection Administrator wasn’t able to see links to any galleries in the Site Collection settings. Moreover, when accessing them using a direct links and then trying to ex. add a new solution, I was being told, that I have no permissions for that operation.
Usually, this issue was related to the settings in SharePoint Admin Center, from the “Custom Script” section. Both should be set to “Allow”:
I knew that, this settings when marked using the UI requires even 24 hrs to get enabled (it can be changed immediately only if you use SPO Management Shell) . So I did that once I got the new tenant, days before facing the issue.
I went back to the site, and checked my user’s permissions. I noticed, that I have a “deny” for “Add and Customize Pages”:
But that issue was related ONLY to the Modern Sites. Nothing I faced in classic sites.
For me the solution was quite simple. Even though, the settings for “Custom Scripts” are set on the SPO level, it seems that they not influence directly the site collections created using the modern experience. To solve it I used SharePoint Online Management Shell (get it from here), and changed that setting manually for my specific Site Collection:
Connect-SPOService Set-SPOSite -Identity https://<your-tenant-name>.sharepoint.com/sites/<your-modern-site-collection-name> -DenyAddAndCustomizePages $false
After you paste that script into the Shell, you will need to provide the URL to your admin site collection and credentials (user must be at least SPO admin).
When script finishes its execution, the “Deny” from my user’s permissions disappeared immediately 🙂
I had this issue when trying to inject a custom script into a modern site collection. I am tenant admin and site collection admin but I got access denied. It seems the issue is with O365 connected modern site collections. I tested with standalone O365 modern site collections and there was no issue.
Setting the DenyAddAndCustomizePages flag fixes the issue.
Thank you for the shared information 🙂