Share via

Page Rendering Elements

CAML has two major types of elements — those for field rendering and schema definition, and those for page rendering. The page rendering CAML elements are designed for use in rendering pages, for instance, when you need to extract the property of a specific field and render it on a page.

SharePoint team Web site pages are rendered using a system similar to ASP script but with a different form of page markup. Since SharePoint Team Services from Microsoft is implemented as an ISAPI extension, the only page requests that can be dynamically rendered are those that go through the SharePoint Team Services DLL (owssvr.dll). A typical URL to the server would be:


The SharePoint Team Services DLL processes this request by first finding the file Default.htm in the root of the current Web site. It then scans this file from beginning to end looking for embedded CAML. As it finds each CAML element, it replaces it with corresponding output text in place in the page. A page that contains CAML XML is called a layout file.

In order for SharePoint Team Services to recognize CAML data islands, the outermost tag must include the ows: namespace prefix. For example:


The above example will insert today’s date within the page.

Elements can be used in two different ways. Such elements as the Today element are used to directly generate a text string to be inserted within the page. Other elements are used to modify text generated by their child elements. For example:

<ows:URL>Link here</ows:URL>

The URL element modifies the text in the body by wrapping an <A> tag pointing to the current item around the text rendered by the body.

Elements can also be concatenated to produce a concatenation of their output. For example:


The above example renders today’s date followed by the current user's ID.

The following table describes CAML page rendering elements.

Name Description
Batch Used for batch processing of commands within HTTP protocol.
Case Used inside a Switch statement to perform a comparison.
Default Contains the default value of a field to which new item forms are initialized.
Expr Contains a CAML expression that is evaluated to determine the course of action for a Switch statement.
ForEach Provides a basic mechanism for enumerating a collection of views or fields defined in the current list.
GetVar Returns a variable in the context of rendering the page.
HTMLBase Returns a string that sets the base element for the current page.
HTTPHeader Used to set one of the HTTP headers.
HttpHost Renders the URL to the virtual server containing the current team Web site.
HttpPath Returns the path to the appropriate OWSSVR.DLL.
HttpVDir Returns the root directory of the current subweb.
IfEqual Allows for conditional rendering based on the comparison of two CAML expressions.
ListProperty Returns the value of a specified column in the List of Lists table.
Project The top-level element in ONET.XML that defines a template for a new Web site based on SharePoint Team Services.
ProjectProperty Returns a global property of the current team Web site.
Property Returns the property from the current ForEach context.
SetList Designates which list is current.
SetVar Sets variables in the context of rendering the page.
Switch Allows for conditional rendering based on the value of a CAML expression.
Today Renders today’s date.
View Defines a SharePoint Team Services view.
XML Used as an outer wrapper to denote a CAML data island on the page.

See Also

Introduction — What Is CAML?

Field Rendering Elements