views:

297

answers:

4

I'm trying to create a content type that will inherit from the Contact content type (that comes with SharePoint). I need most of the fields in there but would like to be able to remove some of them.

Is there a way I can remove the fields I don't want through the XML definition of the Content Type?

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <ContentType ID="0x01004B56BB872BFE984D9611B5D8CF52CB60" Name="Child Contact" Description="Inherits from Contact" Group="...">
    <FieldRefs>
    ??? What would I put there to remove fields that exist in the parent?
    </FieldRefs>
  </ContentType>
</Elements>
A: 

If you don't need those fields then why are you inheriting from that content type in the first place?

jagprinderdeep
I need some fields, but not all of them. I inherit from the Contact contact type which has the fields "Phonetic First Name" and "Phonetic Last Name" that I want to get rid of... The rest of the fields are OK.
Hugo Migneron
A: 

I suggest you rethink your content type inheritance structure then. Define a parent ct that contains JUST the columns shared by both child ct's, and add the other columns to the respective child ct.

Think of it as OO programming, you would not put methods that are used ONLY in subclass B that inherits from class A TO that parent class A, and in the process make that method available in all classes inheriting from A, while they will never be used there, or even worse, be misused...

Colin
+3  A: 

Use this syntax in your content type definition:

<FieldRefs>
      <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name ="Title"  />
</FieldRefs>

You must find proper ID for each filed you want to remove.

Toni Frankola
+1  A: 

Just hide them in child content type by setting HIDDEN="TRUE" attribute. See here for full list of attributes.

Janis Veinbergs
Thanks, very useful list of attributes.
Hugo Migneron