Understanding the FldTypes.xml File
Last modified: April 09, 2010
Applies to: SharePoint Foundation 2010
Each front-end Web server in a deployment of Microsoft SharePoint Foundation has one FLDTYPES.XML file located in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\XML folder. This file is used during list creation to define how field types are rendered in one or more of the different modes for viewing list data, and in visual designers.
Modifying the FLDTYPES.XML file can break an installation of SharePoint Foundation and is not supported. You can, however, create a custom FLDTYPES*.XML file to define rendering of a custom field type in one or more modes.
The following excerpt illustrates the format of FLDTYPES.XML.
The RenderPattern element is obsolete. It is shown here solely to assist in the debugging of custom fields that were originally developed against earlier versions of SharePoint Foundation.
<FieldTypes> <FieldType> <Field Name="TypeName">Counter</Field> <Field Name="TypeDisplayName">$Resources:core,fldtype_counter;</Field> <Field Name="InternalType">Counter</Field> <Field Name="SQLType">int</Field> <Field Name="ParentType"></Field> <Field Name="UserCreatable">FALSE</Field> <Field Name="Sortable">TRUE</Field> <Field Name="Filterable">TRUE</Field> <RenderPattern Name="HeaderPattern"> ... </RenderPattern> <RenderPattern Name="DisplayPattern"> ... </RenderPattern> <RenderPattern Name="EditPattern"> ... </RenderPattern> <RenderPattern Name="NewPattern" DisplayName="NewPattern"> ... </RenderPattern> <RenderPattern Name="PreviewDisplayPattern"> ... </RenderPattern> <RenderPattern Name="PreviewEditPattern"> ... </RenderPattern> <RenderPattern Name="PreviewNewPattern"> ... </RenderPattern> </FieldType> <FieldType> ... </FieldType> ... </FieldTypes>
RenderPattern elements were used to define how an item is displayed in each of the possible modes for viewing list data: Display, Create (New), and Edit. However, this technique is obsolete. Instead, develop user (ASCX) controls to render fields on forms. There are three more pattern types for previewing rendering in a Web-editing application that is compatible with SharePoint Foundation, such as Microsoft SharePoint Designer.
There is a seventh pattern type that was used in earlier versions of SharePoint Foundation to render the header on columns in list views. XSLT stylesheets are now used to render column headers. You can revert to using the render pattern, however, by adding <Field Name="CAMLRendering">TRUE</Field> as a child of the FieldType element. This option is provided as a quick way of ensuring that a custom field developed under older versions of SharePoint Foundation still renders the same way. However, even adding this markup is usually not necessary because the default XSLT header rendering is the same as the default rendering of the HeaderPattern type of RenderPattern. Hence, reverting to RenderPattern rendering of the column header would only be needed if your legacy custom field definition includes a custom HeaderPattern type of RenderPattern.
To create a custom field that derives from a base field type, you can add a field definition to the SCHEMA.XML file of a custom list definition Feature. For a programming task that shows how to add a field to a custom list definition, see How to: Create a Custom List Definition. For information about creating a custom field type, see Custom Field Types. For documentation of the Field Types XML, see Field Types XML.