SharePoint 2010-Content Types and Inherits : the good, the bad and no ugly

I recently had to upgrade SharePoint 2007 code to Visual Studio 2010.

The code contained a content type definition with a RemoveFieldRef tag which allows us to removed a field from a parent content type; typically we remove the Title column…

It worked perfectly in SharePoint 2007, but in SharePoint 2010, my Title column was still there.

Then I noticed when I create a new Content Type SharePoint project item, Visual Studio 2010 add a new SharePoint 2010 attribute : Inherits with a value set to…TRUE;

According to the sdk:

<<Optional Boolean. The value of this attribute determines whether the content type inherits fields from its parent content type when it is created.

If Inherits is TRUE, the child content type inherits all fields that are in the parent, including fields that users have added.

If Inherits is FALSE or absent and the parent content type is a built-in type, the child content type inherits only the fields that were in the parent content type when SharePoint Foundation was installed. The child content type does not have any fields that users have added to the parent content type.

If Inherits is FALSE or absent and the parent content type was provisioned by a sandboxed solution, the child does not inherit any fields from the parent.>>

Ok.

I noticed that Inherits has also an impact on RemoveFieldRef :

Setting this attribute to FALSE did the work and my RemoveFieldRef option worked :

image

 

Then I decided to try the same option on a custom publishing content type, but setting Inherits to FALSE made my publishing…unavailable (and no errors during deployment, I just don’t see it, even by using SharePoint Manager 2010)

Don’t set Inherits to FALSE in custom publishing content types.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s