locked
Adding a column to a custom Discussion Board, not showing up in the Discussion and Message content types RRS feed

  • Question

  • Hello,

    So I'm in the middle of creating a custom list based on the discussion board. Within the schema.xml file, I add a new field node that I want and need to be displayed when a user adds or edits a discussion and/or message.  After doing so, the column shows under list settings of the discussion board, but when I create a new discussion, the column doesn't appear. Meaning, the column was not added to the content types.

    Is there a attribute to the <Field> tag that I could be missing? Just like when you add a column to the list via the UI and the check box of 'Add to all content types' is checked. I'd like to mimic that via my schmea.xml file (Feature).

    Thanks!

    Wednesday, May 4, 2011 12:45 PM

Answers

  • Hi Zeppelin_Zoso,
     
    From your description, you wanted to add a new column which could be displayed in the view when you created a new Discussion Board, and just only wanted to modify schema.xml file, if it was, you can do these in schema.xml file:
    1.       Between <Fields>...</Fields>, add the custom field contained by the list .
    i.e.
    <Fields>
          <Field Type="Text" DisplayName=" TestColumn " Required="FALSE" StaticName=”TestColumn" Name="TestColumn" ………. />
    </Fields>
     
    2.       Between<ViewFields>...</ViewFields> within <Views>...</Views>, add the field reference to be shown in the view of the list.
    i.e.
    <Views>
    <View … >
         <ViewFields>
                <FieldRef Name="TestColumn"/>
         </ViewFields>
    </View>
    </Views>
     
    At last, deploy to your site, and the new column should be displayed in the new Discussion Board.

    Update:
    There are 2 good articles worth ro read:
     
    Creating Custom List Definitions with Custom List Columns for SharePoint Server 2007
     
    How To: Create custom content type and list instance in SharePoint 2010 using Visual Studio 2010
     
    Thanks,
    Daniel
     
     


    Tuesday, May 10, 2011 11:24 AM
    Moderator