Condividi tramite


Data-Defining Elements

Applies to: SharePoint Foundation 2010

Collaborative Application Markup Language (CAML) has two major kinds 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 type definitions or, more commonly, in FldTypes.xml at \\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATES\XML.

Field Rendering and Schema Definition

A field is a column or an attribute containing information that a user can add to a list. Each list on a Web site based on Microsoft SharePoint Foundation has metadata stored in the database. The format of the schema is an XML structure, such as the following:

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

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 rendering patterns for each kind of field. The following table presents the schema used in this file.

Name

Data type

Description

Column2Suffix

Text

Contains text to append to base column name to derive ColumnName2 from ColumnName (for two-column fields such as URL).

DisplayPattern

Note

Contains the HTML template for rendering the field in the display mode of a view or a form.

EditPattern

Note

Contains the HTML template for generating the Edit form control to edit the field.

HeaderPattern

Note

Contains the HTML template for displaying the heading of a table view column.

InternalType

Text

Determines both the behavior of the Column element in rendering data from the SharePoint Foundation 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

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 for editing the initial value of a field.

PreviewDisplayPattern

Note

Specifies how fields are rendered when a display form is edited in Microsoft SharePoint Designer.

PreviewEditPattern

Note

Specifies how fields are rendered when an edit form is edited in Microsoft SharePoint Designer.

PreviewNewPattern

Note

Specifies how fields are rendered when a new form is edited in Microsoft SharePoint Designer.

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

Determines 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).

Display Modes and Display Patterns

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

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, 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

Reference

HTML-Rendering Elements