I was working on some pretty basic custom content types inheriting from the OOTB WSS content types. My child content types had to remove some fields from the parent content types. Here is an example:
Lets say you are inheriting from the OOTB “Event” content type. In it's schema it includes a “Recurrence” field (fRecurrence). This field has the following GUID: {F2E63656-135E-4f1c-8FC2-CCBE74071901} (notice the GUID is in retarded case.)
To create a child content type that inherits from “Event” but excludes the “Recurrence” field, you have to add the following in your custom content type definition (my example excludes some other fields):
1: <ContentType Name="Custom Event" Group="Events" Description=""
2: ID="0x010200603E1A38891D40ba9CD81AB1A4A62049">
3: <FieldRefs>
4: <RemoveFieldRef ID="{f2e63656-135e-4f1c-8fc2-ccbe74071901}" Name="fRecurrence" />
5: <RemoveFieldRef ID="{7D95D1F4-F5FD-4A70-90CD-B35ABC9B5BC8}" Name="fAllDayEvent" />
6: <RemoveFieldRef ID="{9da97a8a-1da5-4a77-98d3-4bc10456e700}" Name="Comments" />
7: </FieldRefs>
8: </ContentType>
The catch is that RemoveFieldRef ID's are _sometimes_ case sensitive. The ID must either be the same case as the GUID defined in the Field XML schema definition, or specifically LOWER case. This will not work:
1: <ContentType Name="Custom Event" Group="Events" Description=""
2: ID="0x010200603E1A38891D40ba9CD81AB1A4A62049">
3: <FieldRefs>
4: <RemoveFieldRef ID="{f2E63656-135E-4f1c-8fc2-cCbe74071901}" Name="fRecurrence" />
5: <RemoveFieldRef ID="{7D95D1F4-F5FD-4A70-90CD-B35abc9B5BC8}" Name="fAllDayEvent" />
6: <RemoveFieldRef ID="{9dA97a8a-1DA5-4a77-98d3-4BC10456e700}" Name="Comments" />
7: </FieldRefs>
8: </ContentType>
Crazy GUID fiasco!!!
- The “Recurrance” field does not get removed.
- The “All Day Event” field gets removed. You can use any case for this (WTF?!?)
- The “Comments” field (Description) also does not get removed. It is identified as {9da97a8a-1da5-4a77-98d3-4bc10456e700}, and you have to use lower case to remove it.
Inconsistent, or I am just missing the point. I've done some tests, but I still haven't found the reason as to why some fields need special cases for their GUID's. I am very keen to hear about other experiences on this. Very interested to know the actual reason for this, or whether it is a bug.
Conclusion:
If you are defining custom content types and you want to reorder or remove some fields from the parent (they always inherit), watch out for the case of the GUIDs. If you are getting duplicates, chances are your RemoveFieldRef ID's should be lower case (or the same case as in the field schema).
Hope this saves some hours.