Example 7 - Adding an in-line, highly customized view

To add an in-line, highly customized view for a list:

  1. Using Microsoft FrontPage, create a new page in a Web site based on SharePoint Team Services from Microsoft.

  2. In HTML View, add the following <META> tag in the document's HEAD section:

    <META Name="Microsoft SharePoint Content Type" Content="Dynamic">
    
  3. Within the document's BODY section, add the following CAML source:

    <ows:XML>
      <SetList>Announcements</SetList>
      <View>
        <ViewFields>
          <FieldRef Name="LinkTitle" Explicit="TRUE"/>
          <FieldRef Name="Expires"/>
          <FieldRef Name="Body"/>
        </ViewFields>
        <ViewBody>
          <HTML><![CDATA[<h1>]]></HTML>
          <Field Name="LinkTitle"/>
          <HTML><![CDATA[</h1><ol>]]></HTML>
          <Fields>
            <HTML><![CDATA[<li>]]></HTML>
            <Field/>
            <HTML><![CDATA[</li>]]></HTML>
          </Fields>
          <HTML><![CDATA[</ol><hr>]]></HTML>
        </ViewBody>
      </View>
    </ows:XML>
    
  4. Save and view the page.

    As a result, a new view of the announcements list is created. The LinkTitle field is specially handled in that it is displayed via an <H1> tag. All the other view fields are handled as list items inside an ordered list. A horizontal rule separates one list record from the next.

Note   This example assumes that the built-in Announcements list has not been deleted.

See Also

Introduction — What Is CAML?

Location of CAML