Limit element (View)

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

Truncates text to a specified size.

<Limit
  AutoHyperLink = "TRUE" | "FALSE"
  AutoHyperLinkNoEncoding = "TRUE" | "FALSE"
  AutoNewLine = "TRUE" | "FALSE"
  Default = "Text"
  ExpandXML = "TRUE" | "FALSE"
  HTMLEncode = "TRUE" | "FALSE"
  IgnoreTags = "TRUE" | "FALSE"
  Len = "Integer"
  MoreText = "Text"
  StripWS = "TRUE" | "FALSE"
  URLEncode = "TRUE" | "FALSE"
  URLEncodeAsURL = "TRUE" | "FALSE">
</Limit>

Elements and attributes

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
AutoHyperLink Optional Boolean. TRUE to surround text with <A> tags if the text appears like a hyperlink (for example, www.microsoft.com).
AutoHyperLinkNoEncoding Optional Boolean. TRUE to surround text with <A> tags if the text appears like 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;).
Default Optional Text. Renders the text assigned to this attribute if the value returned by the Select attribute of another element is an empty string.
ExpandXML Optional Boolean. TRUE to re-pass the rendered content through the Collaborative Application Markup Language (CAML) interpreter, which allows CAML to render CAML.
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.
IgnoreTags Optional Boolean. TRUE to exclude tags when truncating text.
Len Optional Integer. Determines the maximum number of characters to show. The default value is 128.
MoreText Optional Text. Specifies the text to append to the end of the returned string to indicate that its limit has been surpassed.
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

Parent elements

Numerous

Occurrences

  • Minimum: 0
  • Maximum: Unbounded

Remarks

Note that the Limit element will not break words. For example, <Limit Len=3>Microsoft Corporation</Limit> returns Microsoft, not Mic.

Example

The following example limits the text of the Body field to 250 characters and puts an ellipsis ( ...) after the string if it is cut off.

<Limit Len="250" MoreText="..." AutoHyperLink="TRUE"
  AutoNewLine="TRUE">
  <Column Name="Body"/>
</Limit>