Partilhar via


Field Element (View)

Applies to: SharePoint Foundation 2010

Returns the formatted value of a field for use within a view definition.

<Field
  AutoHyperLink = "TRUE" | "FALSE"
  AutoHyperLinkNoEncoding = "TRUE" | "FALSE"
  AutoNewLine = "TRUE" | "FALSE"
  HTMLEncode = "TRUE" | "FALSE"
  Name = "Text"
  StripWS = "TRUE" | "FALSE"
  URLEncode = "TRUE" | "FALSE"
  URLEncodeAsURL = "TRUE" | "FALSE">
</Field>

Attributes

Attribute

Description

AutoHyperLink

Optional Boolean. TRUE to surround text with <A> tags if the text appears to be a hyperlink (for example, www.microsoft.com).

AutoHyperLinkNoEncoding

Optional Boolean. TRUE to surround text with <A> tags if the text appears to be a hyperlink (for example, www.microsoft.com) but without HTML encoding.

AutoNewLine

Optional Boolean. TRUE to insert <BR> tags into the text stream and to replace multiple spaces with a nonbreaking space (&nbsp;).

HTMLEncode

Optional Boolean. TRUE to convert embedded characters so that they are displayed as text in the browser. In other words, characters that could be confused with HTML tags are converted to entities.

Name

Optional Text. Allows the Field element to be used outside the field rendering context by supplying an ID (for example, <Field Name="ID"/>).

StripWS

Optional Boolean. TRUE to remove white space from the beginning and end of the value returned by the element.

URLEncode

Optional Boolean. TRUE to convert special characters, such as spaces, to quoted UTF-8 format (for example, %c3%ab for character ë).

URLEncodeAsURL

Optional Boolean. Like URLEncode, but TRUE to specify that the string to encode is a path component of a URL so that forward slashes ("/") are not encoded.

Child Elements

None

Parent Elements

Numerous

Occurrences

Minimum: 0

Maximum: Unbounded (1 within UrlBaseName)

Remarks

Use the Field (View) element to return a formatted field value for display within a view, and use the Column element to return the raw data value of the field. The Field element does not specify attributes when it is used within UrlBaseName, and only Name is specified when it is used within Expr1, Expr2, or Row.

To create a custom field definition as a pluggable Feature that is based on a default SharePoint Foundation field type and that can be reused across sites and lists, use the Field (Field) element to define a custom site column. To create a custom field definition for a list definition based on a default field type, use the Field (List - Definition) element within a Schema.xml file. To create a custom field type that implements a custom class for special data validation and field rendering, use the Field (Field Types) element.