Exporting and Importing – Cannot import site due to wrong template

When you’re migrating sites using export-spweb and import-spweb, you might receive an error message on the import, when reviewing the import log, and in your shell, similar to this:

FatalError: Cannot import site. The exported site is based on the template SPS#0
but the destination site is based on the template BLANKINTERNET#2. You can import sites only into sites that are based on same template as the exported site.
at Microsoft.SharePoint.Deployment.WebSerializer.IsWebTemplateCompatible(String sourceWebTemplateName, String destinationWebTemplateName)
at Microsoft.SharePoint.Deployment.WebSerializer.SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
at Microsoft.SharePoint.Deployment.XmlFormatter.ParseObject(Type objectType,
Boolean isChildObject)
at Microsoft.SharePoint.Deployment.XmlFormatter.DeserializeObject(Type object
Type, Boolean isChildObject, DeploymentObject envelope)
at Microsoft.SharePoint.Deployment.XmlFormatter.Deserialize(Stream serializationStream)
at Microsoft.SharePoint.Deployment.ObjectSerializer.Deserialize(Stream serializationStream)
at Microsoft.SharePoint.Deployment.ImportObjectManager.ProcessObject(XmlReader xmlReader)
at Microsoft.SharePoint.Deployment.SPImport.DeserializeObjects()
at Microsoft.SharePoint.Deployment.SPImport.Run()
Progress: Import Completed.
Finish Time: 1/22/2009 1:04:44 PM.
Completed with 1 warnings.
Completed with 1 errors.
Log file generated:
D:\prodsitecollection.cmp.import.log

The workaround for this is to create the correct type of destination site.

To determine what type of site is based on the BLANKINTERNET#2 site template, perform the following:

1. Open a SharePoint Management Shell
2. Type Get-SPwebTemplate and press enter

get-spwebtemplate

One way to avoid this error all together is to create the destination (target site) based on the correct template from the get-go.  You can do this by determining the type of site you’re working with
by looking at the web template property of the web.

1. Open a SharePoint Management Shell
2. Know your site URL
3. Type everything between the quotes, and not including the quotes “(get-spweb http://servername/sites/sharepointrocks).webtemplate”

get-spweb

It’s not fool proof but is a good start. And, don’t be fooled by the webTemplateID property, that is not the number that we’re looking for.  See below, the /sites/yo is a team site, so if WebTemplateID were truly the answer to the # part of this question, it would show 0, not 1, because the name property for the Team Site template is, STS#0, not STS#1.  STS#1 is for the Blank Site.

get-spwebtemplate_id_property
Answer:  Trial and error target site creation until import works, or view the HTML source of the home page for the site and search for ‘g_wsaSiteTemplateId’ – the answer will be evident, you will see the template used to create the site.

get-spweb_webtemplate

 

Leave a Reply