locked
How to add new fields into a content type by schema.xml? RRS feed

  • Question

  • Dear all,

    I'm working on an existing SharePoint 2007 project. There is a feature in the solution, within which there are several content type defined.

    Now I need add a new filed into the content type, and the flied is already defined and used in anther content type.

    The filed is defiend like this:

    <Field Name="AmountClaimed" ID="{C5B4B79D-4FA5-4ab5-A6BB-C96A6C55E4DF}" Required="FALSE" DisplayName="Cost Category" Type="Choice" FillInChoice="FALSE" Format="Dropdown">
      <Default>Travel, Accom. and Subsistence</Default> <CHOICES> 
    <CHOICE>Meal cost</CHOICE> 
    <CHOICE>Transportation</CHOICE>
    <CHOICE>Travel, Accom. and Subsistence</CHOICE> <CHOICE>Other(Note 2)</CHOICE> 
    </CHOICES> 
    </Field>

    And I add it into the existing content type like this:

    <FieldRef Name="AmountClaimed" ID="{C5B4B79D-4FA5-4ab5-A6BB-C96A6C55E4DF}" Required="TRUE"/>

    The I use WSP builder to build the WSP package, uninstall the solution in test server, deploy the new WSP package.

    But when I go to the list settings to view the field list of this content type, I can not find the new field I added in schema.xml.

    Does anyone knows how to make it? I hope to make it without coding but just by modify the schema.xml, if possible.


    Alex Du

    Friday, November 2, 2012 2:49 AM

Answers

  • Hi Alex,

    From your description, do you mean that both custom column and custom content type are deployed to site successfully, but when adding the field to the content type, it is not added as expected?

    Would you please go the Site Settings->Content Types, to check the content type, whether the column is added? If this doesn’t work, please try to remove the Required=”TRUE” attribute, in your FieldRef element of the content type, as I have noticed that you type Required=”FALSE” in the field definition, but use Required=” TRUE”  in the content type that reference the field.

    If it isn’t the issue, please feel free to let me know.

    Thanks,
    Qiao
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    tnmff@microsoft.com.


    Qiao Wei

    TechNet Community Support

    Monday, November 5, 2012 2:37 AM
    Moderator