Wednesday, September 3, 2014

Create Discussion Board list definition through Visual Studio 2012 for SharePoint 2013


There was a requirement to create a discussion board list definition through visual studio. So that our client can be able to create list instance with some customization.

Problem Background

We tried to create content type by inheriting Discussion and then created a custom list definition using created content type. But it was not same as the out of the box discussion board – We couldn’t get the reply page and the views as in the ootb.


  • Create a new SharePoint solution
  • Add a content type inheriting from Discussion
    • Right Click on the project –> Add –> New Item –> Content Type –> Name it (I have named it as DisBoardCT) –> Click Add –> Select Discussion from Content type setting page


  • Create a List
    • Right Click on the project –> Add –> New Item –> List –> Click Add select the first option from Choose List Setting Page


  • Add the above created content type to our list



Now you list definition is ready. But this will not work as the out of the box discussion board.

  • Now you have to change the schema.xml
    • Go to the OOTB list definition usually the location is C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\DiscussionsList\Discuss
    • Copy the content in schema.xml and paste on our schema.xml in the visual studio
    • Get the Content type ID which we created.


    • Replace the content type ID in schema.xml with our ID. There will be couple instances of the default content type. “0x012002”image
    • Once you change the content type in schema.xml the default content type in will be set to our custom content type. Please verify


  • Change the Type
    • Change the Type to 108 and the Image to



  • Change the Template type to 108 in list instance elements file.



  • Now deploy the solution and you should be able to get see the our custom discussion board list definition.


I have created a sample and you may download it here.


  1. Perfect!
    ...I was editing the content type name in the schema as well, and it broke down everything: you solved it for me, thanks!!!

  2. Awesome article .thanks for sharing like charm ..