Wednesday 2 February 2011

List Error when picking SiteTemplate - 0x81020012

Case
We were creating a new site definition for a customer build up with elements of the new SharePoint 2010 Features in Visual Studio 2010. At some point the solution started trowing errors when choosing the Site Template with the template picker:



A list, survey, discussion board, or document library with the specified title
already exists in this Web site. Please choose another title. 0x81020012


Problem
After analyzing the problem we discovered that VS2010 what deploying the Template Files to ‘14-hive \ Template \ Solution’ instead of ‘14-hive \ Template \ SiteTemplates \ Solution \ xml’. This way, since the webtemp_*.xml was deployed correctly, it was possible to choose the template in the template picker. When selected, SharePoint couldn’t find the onet.xml-file.

If this onet.xml-file is missing SharePoint throws this fuzzy ‘list, survey, discussion board, or document library with the specified title already exists’ message. You can test this by throwing away the file from your ‘14-hive \ Template \ SiteTemplates \ Solution \ xml’-directory.

What went wrong?
By default VS2010 knows the onet.xml-file should be located in the ‘14-hive \ Template \ SiteTemplates \ Solution \xml’-directory. Every file you add will be configured to be deployed in this path.

But when you include a new file, in this case my onet.xml, VS2010 sets the path to ‘{SharePointRoot} \ Template \ Solution \ SiteDefinition ’.

Solution
Go back to VS2010 and check the following settings in your site definition:

Onet.xml

  • Deployment Location:
    {SharePointRoot}\Template\SiteTemplates\Csolutions.SharePoint.SalesPortal.Site\Xml\
  • Deployment Type: TemplateFile

Webtemp_*.xml

  • Deployment Location:
    {SharePointRoot}\Template\SiteTemplates\Csolutions.SharePoint.SalesPortal.Site\Xml\
  • Deployment Type: TemplateFile

Re-deploy the solution and recreate the sitecollection with the correct template. This solved the problem for me.