Field Rendering Elements

CAML has two major types of elements — those for page rendering and those for field rendering and schema definition. The CAML field rendering elements are designed for use when rendering individual field values. These can appear in field definitions, or more commonly, in FLDTYPES.XML (Program Files\Common Files\Microsoft Shared\web server extensions\50\Templates\1033\xml\).

A field is basically a column or an attribute of information that a user can add to a list. Each list on a Web site based on SharePoint Team Services from Microsoft has metadata stored in the List of Lists table in the database. The format of the schema is an XML structure, such as follows:

  <Field Type="Counter" Name="ID"/>
  . . . other field definitions. . .

In order to simplify the implementation of the various field types, and to allow for a higher degree of flexibility in rendering the various fields, FLDTYPES.XML contains information about the rendering and behavior of each field type. The Field element renders different HTML depending on the data type of the field in question, and FLDTYPES.XML defines the data types and render patterns for each kind of field. The following table presents the schema used in this file.

Name Data Type Description
Column2Suffix Text Text to append to base column name to derive ColumnName2 from ColumnName (for two-column fields like URL).
DisplayPattern Note Contains the HTML template for rendering the field in the display mode of a view or of a form. Typically, the value is <ows:FieldRef/>, but for a Lookup field the value is <A HREF="<ows:LookupHREF/>"><ows:LookupTitle/></A>.
EditPattern Note Contains the HTML template for generating the Edit form control to edit the field. Typically, this value is <INPUT NAME="<ows:FieldName/>" VALUE="<ows:FieldRef/>">.
HeaderPattern Note Contains the HTML template for displaying the heading of a table view column. Typically, the value is <ows:DisplayName/>.
InternalType Text Determines the behavior of the Column element in rendering data from the database and how data is posted back to the database. Can be one of the following values: Text, Note, Number, Currency, Integer, Boolean, DateTime, Threading, Lookup, Choice, URL, Counter, or DisplayOnly. Note that a DisplayOnly field type has no storage of its own.
Name Text The field contains the name of the internal data type as referenced in a Type attribute of the Field element: <Field Type=”Name”/>. Examples are Text, Note, Number, etc.
NewPattern Note Contains the HTML template for generating the New Form control for editing the initial value of a field. Typically the value will be <INPUT NAME="<ows:FieldName/>" VALUE="<ows:DefaultValue/>">.
PreviewDisplayPattern Note This is how fields are rendered when a display form is being edited in Microsoft FrontPage.
PreviewEditPattern Note This is how fields are rendered when an edit form is being edited in Microsoft FrontPage.
PreviewNewPattern Note This is how fields are rendered when a new form is being edited in Microsoft FrontPage.
Sortable Text Specifies whether a field can be sorted. Can be TRUE or FALSE.
TypeName Text Specifies a name in the definition of a field type.
SQLType Text The underlying SQL data type for the given field. Examples are nvarchar(255), memo, integer, float. Used to generate the appropriate SQL (CREATE TABLE) for creation of a field of this type.
SQLType2 Text When not blank, gives the type of a secondary column to create for the current field (see URL field type, for example).

Each of the display modes (Display, Edit, New, etc. ) contains a definition for how to render each of the field data types that are supported by SharePoint Team Services.

For each display mode there is a display pattern, or CAML rendering expression. Some CAML elements are used specifically in display patterns. Others can be used in either context (in other words, for page rendering or for field rendering), but are used primarily in rendering fields. The following intrinsic CAML rendering elements are used to build templates that can include both static HTML and data, as well as metadata of the field being rendered.

Element Description
Column Returns the "raw" data value for a particular field.
Column2 Used in rendering a Link field type.
Escape Used to escape certain characters in strings.
FieldFilterOptions Used in the HeaderPattern sections of FLDTYPES.XML to display filter drop-down menus.
FieldPrefix Returns the Microsoft Office namespace, “urn:schemas-microsoft-com:office:office#”.
FieldRef Used in computed fields to refer to the constituent fields and in views to define what fields are present.
FieldSortImageURL Returns the URL to the image file used to indicate how a column is sorted.
FieldSortParams Returns the sort direction on a list, rendering Asc or Desc based on whether the field has been sorted and the current default sort direction for the field.
IfEqual Allows for conditional rendering based on the comparison of two CAML expressions.
IfNew Returns TRUE if the item is considered new.
ImagesPath Returns the HTTP path to the images directory for the project.
Limit Truncates text to a specified size.
LocaleInfo Transfers server locale information to the client in order to display and edit dates and numbers properly.
PageURL Used anywhere to return the absolute, encoded URL of the current page.
Property Returns the property from the current ForEach context.
ScriptQuote Used for rendering text from the server that must be interpreted as a quoted string.
TodayISO Renders today’s date and time in ISO format.

See Also

Introduction — What Is CAML?

Page Rendering Elements