SharePoint Online: Access Denied Error on Navigation Settings
Problem: When trying to change the navigation settings of a SharePoint Online site, I got an access denied error. Access Required: Sorry, you don’t have access.
I’m sure, I am a Global Admin in Office 365 and Site Collection Administrator for that particular site collection. I tried the PowerShell way and got a similar error: “Access denied. You do not have permission to perform this action or access this resource.“
The solution to the Navigation Settings Access Denied Error:
To fix this issue: You have to set the “Custom Script” setting to “Allow users to run custom script on self-service created sites” in the SharePoint Online Admin Center Settings page, and it takes 24 hours or so to propagate! So, let’s not wait and enable custom script at the site collection level.
PowerShell to Enable Custom Scripts in SharePoint Online Site Collection:
Enable the Custom scripts in the SharePoint Online site to resolve the error!
#Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" $SiteURL="https://crescent.sharepoint.com/sites/marketing" #Get Credentials to connect $Cred = Get-Credential #Connect to SharePoint Online Tenant Admin Connect-SPOService -URL $AdminSiteURL -Credential $Cred #Disable DenyAddAndCustomizePages Flag Set-SPOSite $SiteURL -DenyAddAndCustomizePages $False
Here is another post on enabling custom script in SharePoint Online: How to Enable Custom Script in SharePoint Online?