Mann Software
Mann Software > SharePoint and the Office System > Posts > Content Type Inheritance
Content Type Inheritance

When creating a Content Type declaratively, you may not add any site columns through a FieldRef. In other words, your element file may look like this:

<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<ContentType

ID="0x0100D527CCABB5FB4bd3A34B2EB6059F1E0502"

Name="My CT"

Description="CT #1"

Version="0"

Group="My Content Types" >

</ContentType>

 

</Elements>

It's a perfectly legal element file to define a Content Type and you may be thinking that you'll attach columns later programmatically. However, if you do this then your Content Type will not inherit any columns from its parent Content Type.

To overcome this, assuming you need to, simply re-add the default Title column in a <FieldRef> and all of the other columns in the hierarchy of your Content Type will be inherited as well. Your element file will now look like this:

<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<ContentType

ID="0x0100D527CCABB5FB4bd3A34B2EB6059F1E0502"

Name="My CT"

Description="CT #1"

Version="0"

Group="My Content Types" >

 

<FieldRefs>

<!-- re-add the built-in WSS Title column so other inherited columns are inherited properly-->

<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"

Name="Title" DisplayName="Title" Sealed="TRUE" Required="TRUE" />

</FieldRefs>

</ContentType>

 

</Elements>

Now, all of the columns defined further up the hierarchy, including the Title column, will be inherited properly.

-Dave

Comments

Waldek Mastykarz

Including an empty FieldRefs (<FieldRefs />) element is sufficient too.
System Account at 8/15/2009 3:07 AM
SharePoint Server MVP Community Kit for SharePoint Philly Office Geeks ISPA