Project and List Properties Available from CAML

When you are building a DVWP in SharePoint, there are some project (Web site) and list properties that are available to you directly from CAML that aren’t well-documented, which you can use if you request them directly.  For instance, if you add the following to your CAML <ListProperty Name=”Title” /><ProjectProperty Name=”Title” />, the titles of the project and list are available to you:

<xsl:value-of select=”@ListProperty.Title” />
<xsl:value-of select=”@ProjectProperty.Title” />

These properties are especially useful when you build CrossList DVWPs in order to build up links to items and to display information about them on the page.

Here’s an actual example from a project I worked on:

&lt;View&gt;&lt;Webs Scope="SiteCollection"&gt;&lt;/Webs&gt;&lt;Lists ServerTemplate="104"&gt;&lt;/Lists&gt;&lt;Query/&gt;&lt;ViewFields&gt;&lt;ProjectProperty Name="Title"/&gt;&lt;FieldRef Name="ID"/&gt;&lt;FieldRef Name="Title"/&gt;&lt;FieldRef Name="Body"/&gt;&lt;FieldRef Name="FileDirRef"/&gt;&lt;FieldRef Name="Created"/&gt;&lt;FieldRef Name="Author"/&gt;&lt;FieldRef Name="Expires"/&gt;&lt;FieldRef Name="PermMask"/&gt;&lt;FieldRef Name="ShowOnRootPage"/&gt;&lt;/ViewFields&gt;&lt;/View&gt;

and again in “English”:

<View>
  <Webs Scope="SiteCollection"></Webs>
  <Lists ServerTemplate="104"></Lists>
  <Query/>
  <ViewFields>
    <ProjectProperty Name="Title"/>
    <FieldRef Name="ID"/>
    <FieldRef Name="Title"/>
    <FieldRef Name="Body"/>
    <FieldRef Name="FileDirRef"/>
    <FieldRef Name="Created"/>
    <FieldRef Name="Author"/>
    <FieldRef Name="Expires"/>
    <FieldRef Name="PermMask"/>
    <FieldRef Name="ShowOnRootPage"/>
  </ViewFields>
</View>

ProjectProperty.Property Value
A string that contains the name of a project property listed in the following table.

Name Value
BlogCategoryTitle Category of the current post item.
BlogPostTitle Title of the current post item.
Description Description of the current Web site.
RecycleBinEnabled 1 if the recycle bin is enabled; otherwise, 0.
SiteOwnerName User name of the owner for the current site collection.
SiteUrl Full URL of the current site collection.
Title Title of the current Web site.
Url Full URL of the current Web site.

See ProjectProperty.Property Property for the original MSDN article.

ListProperty.Property Value
A string that contains the name of a property listed in the following table.

Name Value
Created Date and time the list was created.
DefaultViewUrl Server-relative URL of the default list view.
Description Description of the list.
EnableSyndication true if RSS syndication is enabled for the list; otherwise, false.
ItemCount Number of items in the list.
LinkTitle Title linked to list.
MajorVersionLimit For a document library that uses version control with major versions only, maximum number of major versions allowed for items.
MajorWithMinorVersionsLimit For a document library that uses version control with both major and minor versions, maximum number of major versions allowed for items.
RelativeFolderPath Site-relative URL for the list.
Title Title of the list.
ViewSelector View selector with links to views for the list.

See ListProperty.Property Property for the original MSDN article.