Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Anybody out there with a good understanding or a good reference of how the attributes that make up a custom list definition apply to the list columns when you define Fields and FieldRefs in multiple places. For example, it is not uncommon to have a custom list definition where you have ElementManifest files that define the attributes in many places, such as:

  1. Fields.xml - defines Field elements that become site columns
  2. Elements.xml - for each content type, defines FieldRef elements that reference the site columns
  3. Schema.xml - for each list definition that define Field and FieldRef elements that reference the list columns and content types

In each of those, you can define attributes on the Field and FieldRef elements such as Required="TRUE", ShowInNewForm="FALSE", etc... When you have it defined in multiple places for the same field (same ID and InternalName), which attribute will end up being the one you see on the list. While I was thinking that the precedence of how those attributes apply would go in the order of site column - site content type - list content type - list column that doesn't seem to be the case. Looks like whatever you put in the site column definition (Fields.xml) has the highest priority and can’t be overridden in elements that define list columns. It takes a lot of trial and error to get those things right, I was wondering if somebody has gone through the effort of testing the different combination and sharing the results.

share|improve this question

1 Answer 1

The way I have observed it to work is that the most narrow scope takes precedence. In other words, the Field defined in the list definition takes predecedence over the the definintion in the content type, takes precendences over the site column. And if you really want to get tricky, you can override a parent content type's field in a child content type.

However, if the field is "Sealed" at any level, anything below that is ignored.

share|improve this answer
    
Thanks for your input. It is interesting, because my experience so far is to the contrary. If I have a <Field ShowInNewForm=... /> in elements.xml that defines site columns and in elements.xml that defines list fields, it is the site column attribute that takes precedence. However there may very well be another attribute that plays a role, like the Sealed attribute you mentioned. I do not have that though in any of the Field or FieldRef elements. –  Tom Sep 30 '11 at 9:00
    
It may very well be that some of the attributes behave differently than others. I can only say for certain that I have overridden either the display name or required attributes. –  Jon Lester Sep 30 '11 at 15:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.