SharePoint: Hide Parent field in child content type

Suppose we want to hide the parent field of a content type in the derived child content type. RemoveFieldRef can be used to achieve that in the element manifest file. But there is one important thing to remember, when creating content types in Sharepoint 2010 using Visual studio an Inherits attribute is set to TRUE by default and RemoveFieldRef doesn't have any effect in that case. So, change the inherits attribute to FALSE and RemoveFieldRef does its work. Let's see an example.

Create a project in VS 2010 and select Content Type as the project template and deploy the solution as Farm solution. Select the parent content type as Document. Following is the elements file.

As can be seen the Inherits attribute is set to False. Also I have added a field named Department in the new content type.
In the <FieldRefs> section, I am removing the Title field which appears in the document content type which is our parent content type. The GUID of the Title field can be obtained from the fieldswss.xml file located at 14\Template\Feature\fields folder.
Now deploy your solution and use your content type in a document library and you will find that Title field is no longer present in the child content type.
Note: One important thing to remember is if the solution is deployed as sandbox solution and Inherits attribute is set to false then all the parent fields become invisible and need to be added in the <FieldRefs> section on our own.
profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+