Problem with VS2010 beta 2 Site Definition
I encountered the following problem while creating a new custom Site Definition in Visual Studio 2010 beta 2.
The problem occurs when trying to create a new Document Library in the site based on the custom Site Definition.
Error message:
Error An error occurred while getting items from the "" provider: Cannot complete this action. Please try again.
Read on to see the solution for this error.
Visual Studio 2010 now has native integration of SharePoint 2010 projects.
After creating the new Site Definition Project in the onet.xml file contains the following:
<?xml version="1.0" encoding="utf-8"?>
<Project Title="SampleSiteDefinition" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
<NavBars>
</NavBars>
<Configurations>
<Configuration ID="0" Name="SampleSiteDefinition">
<Lists/>
<SiteFeatures>
</SiteFeatures>
<WebFeatures>
</WebFeatures>
<Modules>
<Module Name="DefaultBlank" />
</Modules>
</Configuration>
</Configurations>
<Modules>
<Module Name="DefaultBlank" Url="" Path="">
<File Url="default.aspx">
</File>
</Module>
</Modules>
</Project>
Now you can modify to the onet.xml and default.aspx as you like.
When deploying the new Site Definition, creating a site, and then trying to create a new Document Library you get the error above. The solution for the error turned out to be the missing declaration of the <DocumentTemplates> XML node.
Correct default onet.xml should be:
<?xml version="1.0" encoding="utf-8"?>
<Project Title="SampleSiteDefinition" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
<NavBars>
</NavBars>
<DocumentTemplates>
</DocumentTemplates>
<Configurations>
<Lists/>
<SiteFeatures>
</SiteFeatures>
<WebFeatures>
</WebFeatures>
<Modules>
<Module Name="DefaultBlank" />
</Modules>
</Configuration>
</Configurations>
<Modules>
<Module Name="DefaultBlank" Url="" Path="">
<File Url="default.aspx">
</File>
</Module>
</Modules>
</Project>
After re-deploying the Site Definition and creating a new Site, you are able to create a Document Library.


