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.



5 comments
Simon Ovens says:
February 7, 2010 at 05:48 (UTC 2 )
Nice work! I had same problem until now so thanks for saving me untold hours
ThumNet says:
February 15, 2010 at 01:43 (UTC 2 )
@Simon Ovens
Good to see this helped someone!
Joseph says:
March 10, 2010 at 19:37 (UTC 2 )
This fail carried over into the RC. Redonkulous!
nfl jerseys says:
September 16, 2010 at 04:27 (UTC 2 )
I am the first time on this site and am really enthusiastic about and so many good articles. I think it’s just very good.
ThumNet says:
September 16, 2010 at 07:20 (UTC 2 )
Thank you!