Donnerstag, 27. Mai 2010

The template you have chosen is invalid or cannot be found

Today I solved another sharepointastic riddle. As you maybe know, it's possible to assemble a web with all lists, content and what else you need, and save it as Site Template for reuse. After that you can create new sites by gui or on programmatical way.
But be careful! If you created the .stp-File on a MOSS 2007 with Enterprise-licence, you may see this nice error-message when you try to create a site on a MOSS 2007 without Enterprise-licence (Standard-licence only):

"The template you have chosen is invalud or cannot be found". Jippiejajee Schweinebacke!
The first location I visited was the SharePoint-Logs. Very often I don't find any clues for problems but this time - oh wonder - I did:

Applying template "Deployment.stp" to web at URL "http://server/sites/test/deployment".        
05/27/2010 14:07:51.87         w3wp.exe (0x06D4)                               0x0A14        Windows SharePoint Services           Fields                                88ys        Medium          Failed to get the site template for language 1033, search key 'Deployment.stp'. This warning is expected when provisioning from a custom web template.        
05/27/2010 14:07:53.57         w3wp.exe (0x06D4)                               0x0A14        Windows SharePoint Services           Fields                                936z        Medium          Marking web-scoped features active from manifest at URL "http://server/sites/test/deployment"        
05/27/2010 14:07:54.41         w3wp.exe (0x06D4)                               0x0A14        Windows SharePoint Services           General                               936x        High            Failed to mark site-scoped features active in site 'http://server/sites/test/deployment'.        
05/27/2010 14:07:54.44         w3wp.exe (0x06D4)                               0x0A14        Windows SharePoint Services           General                               72h9        High            Failed to apply template "Deployment.stp" to web at URL "http://server/sites/test/deployment".        
05/27/2010 14:07:54.44         w3wp.exe (0x06D4)                               0x0A14        Windows SharePoint Services           General                               72k2        High            Failed to apply template "Deployment.stp" to web at URL "http://server/sites/test/deployment", error The template you have chosen is invalid or cannot be found. 0x81071e44        
05/27/2010 14:07:54.44         w3wp.exe (0x06D4)                               0x0A14        Windows SharePoint Services           General                               8kh7        High            The template you have chosen is invalid or cannot be found.

Alright, this approved my assumption an Enterprise-feature that's not available in Standard-licence is making trouble here.
So I activated google for a page that lists the differences between Enterprise- and Standard-Features and after a while I found a helpful blogpost in the msdn:

Office SharePoint Server Enterprise Site features

Internal Feature Name:  PremiumWeb
Feature Id:  0806D127-06E6-447a-980E-2E90B03101B8
Feature Definition Id
Feature Display Name
BizAppsListTemplates (KPI List)

These are the features on Web-Scope that aren't available on the Standard-licenced server. The blog-post also lists Enterprise-features on SiteCollection - and WebApplication-Scope.

Now I had to look into the .stp-File. To do so, I renamed the deployment.stp to and extracted it into c:\temp\deployment.
I opened the manifest.xml, searched for each of the feature definition ids and removed the whole -tags. Now the tricky part came: how to get back all extracted files to a .stp without writing a .ddf-file?

Forget about MAKECAB.EXE, use CABARC.EXE! It's a tool in Microsofts Cabinet Software Development Kit; you can download it here:

The webpage on lists a lot examples of how to use cabarc. So I copied CABARC.EXE into c:\temp and used this command to create my new deployment.stp-file:

c:\temp\cabarc n deployment.stp deployment\*.*

Now I have a new working .stp-file I can use as SiteTemplate to create sites on a MOSS 2007 with Standard-licence.