Freigeben über


Custom SharePoint Site Definition with Discussion list view

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

  • Anonymous
    September 11, 2010
    If you are looking for a reporting or document generation add-on to SharePoint, take a look at this <a href="http://www.sharepointreports.info">SharePoint reporting</a> site. It has basic info on all the vendors. It makes for a great starting point.

  • Anonymous
    January 06, 2011
    I am working with sp2010 and this works well but I am adding this to my onet.xml I will get at blue bar around the view list. But if I am adding for example a listviewwebpart or a xsltview or something else and set the property to title only or something the blue bar gets removed but then I am back to the problem you having with item disappearing when clicking on them after they are created although they are in the forum list. Any ideas on how to make this work in sp2010?

  • Anonymous
    February 06, 2011
    I already tried that on SP2010 and it is working. Maybe that blue bar is coming from a stylesheet you have! Please check it with the IE developer tools to check where is that blue bar coming from.

  • Anonymous
    August 29, 2011
    Thanks for this it worked perfectly in SP2010, I have been trying to work this out for a day now.