I am creating a site definition that involves both v2 and v3 web parts. Going through standard tutorials on creating site definitions, I copied and used the sts folder – which had only v2 web parts.

A v2 web part in onet.xml has the following format:

<alluserswebpart webpartzoneid="Right" webpartorder="1"><![CDATA[     <webpart xmlns="http://schemas.microsoft.com/WebPart/v2">      <assembly>Microsoft.SharePoint, Version= 12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</assembly>      <typename>Microsoft.SharePoint.WebPartPages.MembersWebPart</typename>      <title>$Resources:wp_Members;</title>      <description>$Resources:wp_Members_Desc;</description>      <frametype>Standard</frametype>      <isvisible>true</isvisible>   </webpart>]]></alluserswebpart>

I needed to add a v3 (custom web part) to the site definition. Of course the format above will not work (and I learned this through some trial and error).

So a v3 webpart looks in onet.xml looks like the following:

<AllUsersWebPart WebPartZoneID="LeftNavBar" WebPartOrder="1"><![CDATA[    <webParts>      <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">         <metaData>            <type name="YourCompany.SharePoint2007.SideNav.SiteNav, YourCompany.SharePoint2007.SiteNav, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e2c0c4fc62593f5e" />         <importErrorMessage>Cannot import this Web Part.</importErrorMessage>         </metaData>         <data>            <properties>               <property name="Title" type="string">Site Navigation</property>            </properties>         </data>      </webPart>   </webParts>]]>                  </AllUsersWebPart>
VN:F [1.9.22_1171]
Rating: 5.3/10 (4 votes cast)
VN:F [1.9.22_1171]
Rating: -1 (from 1 vote)
v2 and v3 Web Parts in Site Definitions (onet.xml), 5.3 out of 10 based on 4 ratings  
Be Sociable, Share!
  • Tweet