This issue most frequently occurs because the Community Sites Feature site feature, the SharePoint Server Publishing site feature, or the SharePoint Server Publishing Infrastructure site collection feature is currently enabled or was previously enabled for the affected site.
SharePoint doesn’t support creating a template from a site where publishing or community features were enabled
Well, since theoption is hidden from the publishing sites we all used the following URL to go there directly:
Well, thatgoing to work anymore in if your site is a or have the .
In order to get around this issue you need to update a single property page value in your SPWeb object for the site you are trying to save as a template and you are good to go. The property is called SaveSiteAsTemplateEnabled. We need to set that property to true that’s all
You can use the below sample script for the same in SPO
#Load SharePoint CSOM Assemblies
[System.Reflection.Assembly]::LoadFile("C:\***\Microsoft.SharePoint.Client.dll") | Out-Null
[System.Reflection.Assembly]::LoadFile("C:\***\Microsoft.SharePoint.Client.Runtime.dll") | Out-Null
#Variables for Processing
$SiteUrl = "https://sharepointcollabs.sharepoint.com/sites/pdkmtest"
# Get a reference to the target site
$password = Read-Host -Prompt "Enter password" -AsSecureString
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("****@domain.com", $password)
#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $credentials
# Update the property bag value and set it to the string value “true”
$Context.Web.AllProperties["SaveSiteAsTemplateEnabled"] = "true"
# Commit the property change to server
Now if you navigate to the Save site as a template page using the URL directly it will show fine and it will allow you to save the site as a template which stores a copy in the Solution gallery of the site collection