Team blog of MCS @ Middle East and Africa

This blog is created by Microsoft MEA HQ near shoring team, and it aims to share knowledge with the IT community.With its infrastructure and development sides,It brings to you the proven best practices and real world experiences from Subject Matter Experts
Follow Us On Twitter! Subscribe To Our Blog! Contact Us

Custom SharePoint Site Definition with Discussion list view

Custom SharePoint Site Definition with Discussion list view

  • Comments 1
  • Likes

I have been trying to develop a new custom SharePoint site definition on SharePoint 2007 that would put a discussion list view web part on the home page of the created site.

 

 

Now everything seemed to be working fine and list view was added to the home page but when you try to click on any discussion link you would be redirected to the Default.aspx page (same page) and the all discussion items would disappear from the list view   clip_image002I have been searching for like two days and investigating this issue. So let me revise with you what I did first.

 

 

As usual I created the folder with the ONET.XML file. In this file I added the lists I needed and one of them was the discussions list as below:

 

 

                        <List Type="108" Title="Committee Discussions" Url="Lists/Discussions" QuickLaunchUrl="Lists/Discussions"/>

 

 

Then I added the view I needed to the “DEFAULT.ASPX” file as below:

 

 

                        <View List="108" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="4" ShowHeaderUI="FALSE"/>

 

 

Nothing strange right simple and straight forward stuff. Now when I created a new site using this site definition it created the list successfully and the view web part is added to the DEFAULT.ASPX page. So far so good. I added several discussions to the discussions list and they are visible on the list view web part. BUT when you click any item it directs you to the same DEFAULT.ASPX page but now the discussions list view does not show any itemsclip_image004. I started to investigate more and the strangest thing is that when you hover over the items link in the web part it shows that it will try to open the item using the DEFAULT.ASPX page, while if you add a new discussion list view web part it is pointing to FLAT.ASPX page clip_image002and of course this works.

 

 

After many trials and frustrations I found the fairly simple solution. You need just to change the view line in the ONET.XML file to be as follows.

 

 

                        <View List="108" BaseViewID="0" WebPartZoneID="Left" ContentTypeID="0x012001" WebPartOrder="4" ShowHeaderUI="FALSE"/>

 

 

It seems that there is an issue with how discussions list was built and that the discussion is a custom content type so you need to specify that in the view and all was working fine clip_image006

Comments
  • You saved my day. Thanks

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment