“Cannot import Web Part” fix for Social Web Parts

August 14th, 2012 | Posted by Jeffrey Paarhuis in Uncategorized

I’m creating a sandboxed web template for Office 365. I’m adding several web parts to a page and it’s working fine until I add Social web parts, like a Note Board or Tag Cloud. When I add one of these to a page I receive the famous “Cannot import Web Part” error upon deploying a site with this template.

The problem is that SharePoint exports the web part definition as a .webpart (v3) file. As it seems, Social Collaboration Web Parts don’t work well together with a v3 web part definition. When you change it to an old v2 (.dwp) definition it works perfectly.

So, this doesn’t work:

 <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
 SocialCommentWebPart, Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
 <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
 <property name="Height" type="string" />
 <property name="AllowZoneChange" type="bool">True</property>
 <property name="AllowConnect" type="bool">True</property>
 <property name="ExportMode" type="exportmode">All</property>
 <property name="HelpUrl" type="string" />
 <property name="Hidden" type="bool">False</property>
 <property name="TitleUrl" type="string" />
 <property name="WebPartPropertyDisplayItems" type="int">20</property>
 Enable users to leave short, publicly-viewable notes about this page.
 <property name="AllowHide" type="bool">True</property>
 <property name="ChromeState" type="chromestate">Normal</property>
 <property name="AllowMinimize" type="bool">True</property>
 <property name="Title" type="string">Posts</property>
 <property name="ChromeType" type="chrometype">TitleOnly</property>
 <property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
 <property name="Width" type="string" />
 <property name="WebPartPropertySpecifiedAddress" type="string" null="true" />
 <property name="HelpMode" type="helpmode">Modeless</property>
 <property name="CatalogIconImageUrl" type="string" />
 <property name="AllowEdit" type="bool">True</property>
 <property name="TitleIconImageUrl" type="string" />
 <property name="Direction" type="direction">NotSet</property>
 <property name="AllowClose" type="bool">True</property>
 <property name="WebPartPropertyAllowNewComment" type="bool">True</property>

And this works:

 <Description>Displays a list of your colleagues and their recent changes.</Description>
 <Assembly>Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>

Note the change from “http://schemas.microsoft.com/WebPart/v3” to “http://schemas.microsoft.com/WebPart/v2“. Also note the absence of the <webParts> tag, which isn’t allowed in the v2 web part definition.

In this sample I’ve taken the Note Board Web Part (SocialCommentWebPart), but you can use whatever web part you want by changing the TypeName.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

3 Responses

Leave a Reply

%d bloggers like this: