Wednesday, February 26, 2020

Access Denied Error on Save Site as Template in SharePoint Online

To fix this problem, we need to enable custom scripts. Here is how to fix the access denied error on Save Site as Template.


  • Login to SharePoint Online Admin Center
  • Click on Settings from the left navigation >> Scroll down to "Custom Script" section
  • Set "Allow users to run custom script on personal site" and "Allow users to run custom script on self-service created sites" options. Click on "OK" to save your changes.

However, this change may take up to 24 Hours to reflect. To enable scripting on a particular site collection immediately, use this PowerShell script in SharePoint Online Management Shell.

#Config Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$SiteURL="https://crescent.sharepoint.com"

#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

No comments:

Post a Comment