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 example, when you need to extract the property of a specific field and render it on a 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:
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:
<ows:XML> <Today/> <UserID/> </ows:XML>
The previous example renders today's date followed by the current user's ID.
The following table describes some of the prominent CAML HTML-rendering elements.
|Batch||Used for batch processing of commands within HTTP protocol.|
|Case||Used inside a Switch or FieldSwitch 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 or FieldSwitch statement.|
|FieldSwitch||Allows for conditional rendering based on the value of a CAML expression.|
|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.|
|HttpHost||Renders the URL of the virtual server containing the current Web site.|
|HttpPath||Returns the path to the appropriate OWSSVR.DLL.|
|HttpVDir||Returns the root directory of the current site.|
|IfEqual||Allows for conditional rendering based on the comparison of two CAML expressions.|
|ListProperty||Returns the value of a specified column in the Lists table of the database.|
|Now||Renders the current time.|
|Project||The top-level element in ONET.XML.|
|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.|
|URL||Renders a URL.|
|View||Defines a view in Windows SharePoint Services.|
|XML||Used as an outer wrapper to denote a section of CAML.|