Tag Archives: save-site-as-template

save site as template publishing site 1920x1080

Save site as a template publishing site SharePoint 2013





Save site as a template


Save site as a template publishing site

We all know that SharePoint doesn’t support saving publishing sites as a template. I don’t recommend doing that anyway as the produced template will have errors and isn’t reliable to be used in production to create new sites off of. However, sometimes as a developer you need to save a publishing site as a template to see how SharePoint packages things. This can help you build your own custom web template which is a neat thing and replaces the need to save a publishing site as template.

Well, since the Save site as a template option is hidden from the publishing sites settings page we all used the following URL to go there directly:

/_layouts/savetmpl.aspx
Or
/_layouts/15/savetmpl.aspx

Well, that is not going to work anymore in SharePoint 2013 if your site is a publishing site or have the publishing features activated. You basically get that following error: The “Save site as template” action is not supported on this site.

ErrorSaveSiteAsTemplate Save site as a template

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. This can be done in powershell.

Advertisements
Advertisements
# Get a reference to the target site
$web = Get-SPWeb http://Intranet.SPmcse.com/Publishing

# Update the property bage value and set it  to the string value “true”
$web.AllProperties[“SaveSiteAsTemplateEnabled”] = “true”

# Commit the property change to server
$web.Update()
save site as template powershell

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. Make sure you have enough space in your C drive temp folder because it uses that location as a staging directory.

Advertisements
Unable to save site as template 1920x1080

Unable to save site as template “unexpected error has occurred”

Unable to save site as template

Unable to save site as template

User has raised the problem ticket by mentioning facing problem while save site as template, additionally the templates are getting saved in the solution gallery but not able to activate it also.

Error Message

An unexpected error has occurred.
Troubleshoot issues with Microsoft SharePoint Foundation
Correlation ID: acd95f50-4049-4625-9682-aa93aded118f

Troubleshooting

Further debugging in the SP ULS logs and we found some strange facts which are based on event receivers- please refer below

SPSolutionExporter: Microsoft.SharePoint.SPException: Feature definition with Id 77658379-50ff-4e1e-a431-5652bee07a87 failed validation
Looking for ‘ReceiverAssembly’ attribute in manifest root node for solution
Looking for ‘ReceiverClass’ attribute in manifest root node for solution
The ‘Format’ attribute is invalid – The value ‘CheckBoxes’ is invalid according to its datatype

I debug further to find out where the problem. I downloaded the saved wsp’s from /_catalogs/solutions/Forms/AllItems.aspx to my desktop. Renamed it to .cab. Extracted all the contents and found some interesting facts along with manifest.xml file like List Instances, Modules, Property bags, web template. Inside List Instances, I found ElementsFields.xml Once I opened the above xml file, search for the check boxes and found the following

save as template

Further exploration on this, it seems that the checkbox attribute is invalid and needs to be modified.

Resolution

Remove that affected column / remove the affected content type – does not require IISRESET also.