What is RemoveFieldRef?
RemoveFieldRef is an element used in a content type definition to remove fields from the parent content type. I find this declarative approach much easier to implement than if you would have done it by code.
You will find here the msdn reference of the RemoveFieldRef element.
How to use it?
We want to create a Content Type which inherits from the Content Type Page but we want to get rid of the fields Contact Picture and Rollup Image.
The followint printscreen illustrates this example.
To make the example “more real”, I have also added two custom fields CustomCol1 and CustomCol2 just as an example.
What’s the catch?
If you take a closer look at the example, you will see that to make the RemoveFieldRef working, you need:
- Use Inherits=”FALSE” in the definition of the content type
- You must imperatively use the appropriate case when defining the ID parameter of the RemoveFieldRef, sometimes lower-case, sometimes upper-case
You will see that PublishingContactPicture ID is in lower-case while PublishingRollupImage ID is in upper-case.
A small trick, SharePoint Manager can be used to find out the proper way of writing the ID.
I usually copy-paste if from the Schema tab.
I hope you will find this useful.