locked
Custom content type with custom fields RRS feed

  • Question

  • Hello,

    I have created a custom content type using VS2005 extensions for WSS v1.1 project templates. I also created some custom field controls.  Now, i would like to make my custom content type use my custom field controls instead of the sp default ones. There are o lot of articles and tutorials out there that show how to build a custom content type or custom field controls but none show to can you make the both of them work togheter.
    Is this even possible?
    Any link, hint on how to do this?
    Thanks!
    Friday, March 20, 2009 3:17 PM

Answers

  •  
    Its very similar to adding sp default fields to your Content Type.  The type name is the key for adding your custom Field control to your content type definition


    1) What is my field type name? 

    Open your custom field definition fld_types_*.xml, the TypeName property will give you the Type of your field

      <Field Name="TypeName">MyCustomField</Field>

    2)  Create your new Field, based on your custom field

      <Field ID="Replace with new GUID" Type="MyCustomField" Name="Your FieldName" DisplayName="My Custom Field" StaticName="Your FieldName" Hidden="False" Required="FALSE" Sealed="FALSE" DisplaceOnUpgrade="TRUE" />

    3) Now add this Field to your ContentType and to your list definition as you do with other sp field type.

    <FieldRef ID="Your Field GUID" Name="Your FieldName" />

    Let me know if you have any other question.

    Also - If you are not familiar with ContentType or ListDefinition then you can use SharePoint Solution Generator to generate new project based on already created listdefnitions and see how things are related or defined in ListDefinitions.


    Thanks,
    Suhaib Khan

    • Proposed as answer by Suhaib.Khan Friday, March 20, 2009 4:03 PM
    • Marked as answer by Andrei COTIGA Monday, March 23, 2009 11:40 AM
    Friday, March 20, 2009 4:03 PM

All replies

  •  
    Its very similar to adding sp default fields to your Content Type.  The type name is the key for adding your custom Field control to your content type definition


    1) What is my field type name? 

    Open your custom field definition fld_types_*.xml, the TypeName property will give you the Type of your field

      <Field Name="TypeName">MyCustomField</Field>

    2)  Create your new Field, based on your custom field

      <Field ID="Replace with new GUID" Type="MyCustomField" Name="Your FieldName" DisplayName="My Custom Field" StaticName="Your FieldName" Hidden="False" Required="FALSE" Sealed="FALSE" DisplaceOnUpgrade="TRUE" />

    3) Now add this Field to your ContentType and to your list definition as you do with other sp field type.

    <FieldRef ID="Your Field GUID" Name="Your FieldName" />

    Let me know if you have any other question.

    Also - If you are not familiar with ContentType or ListDefinition then you can use SharePoint Solution Generator to generate new project based on already created listdefnitions and see how things are related or defined in ListDefinitions.


    Thanks,
    Suhaib Khan

    • Proposed as answer by Suhaib.Khan Friday, March 20, 2009 4:03 PM
    • Marked as answer by Andrei COTIGA Monday, March 23, 2009 11:40 AM
    Friday, March 20, 2009 4:03 PM
  • That did it!
    many thanks!
    Monday, March 23, 2009 11:40 AM