Tuesday, February 23, 2010

DiscussionBoard ListView in onet.xml

When tried to create site definition and added ListView for DiscussionForum. Link of added Item redirected to the default Web page for the site intead of open.
<View List="Discussion Forums"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>

After investigation I found error occur if the XML parser cannot find a matching content type ID.

Solution:
add the ContentTypeID attribute together with the content type value "0x012001" to the View element code of the discussion Web part in the Onet.xml file:
<View List="Discussion Forums" ContentTypeID="0x012001"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>