SharePoint

SharePoint 2007 – Site Definition fails to deploy


There are many articles about site definitions. The trend seems to go towards using less site definitions or at least smaller site definitions and adding features to do all the work. Having said that, I still like to use site definitions for an initial deployment (read deployments before the cusotmer has gone into production) as it’s easy to make small changes the main structure of the site and redeploy the solution.

Many things can go wrong however and today I came around yet another silly (they’re always silly typo mistakes and many silly mistakes create one difficult puzzle).

I got these exception messages in my ULS logs after I created a site collection using my new template:

CreatePortal failed creating portal webs. Microsoft.SharePoint.SPException: The template you have chosen is invalid or cannot be found. —> System.Runtime.InteropServices.COMException (0x81071E44): The template you have chosen is invalid or cannot be found.
at Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId)
at Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) –
— End of inner exception stack trace —
at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
at Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId)
at Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate)

In these caes you know that there is something wrong somewhere. So I checked that my template name was consistent throughout the solution.

All looked ok.

Then I checked my webtemp and noticed the ID beign set to 0

<Template Name=”MyWeb” ID=”0″>

I changed the ID to 10001:

and all worked fine.

Advertisements

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s