Thursday, 31 January 2008

Custom SharePoint Reports using CAML

I've long wondered how the default SharePoint Site Collections reports are created, and finally I came across an article on how this is done. It seems the only thing required, is a CAML query.

The following article from the MS ECM blog explains how to create your own reports with a number of examples using CAML queries. Check it out.

A summary of how to do it:

Site Actions > Manage Content and Structure > Content and Structure Reports > New item and fill in the following information:

  • Report Title
  • Leave both Resource Ids empty, they're for internal use (?)
  • CAML List Type - You can specify a list template here if you only want your report to search through a specific type of list. For example, the out of the box "My Tasks" report specifies in this field to ensure the report only queries the My Tasks list. This SDK article has a list of these ServerTemplate values for each SharePoint list type.
  • CAML Query - The CAML query for the report
  • Target Audience - if you want the report to be targeted to a particular audience
  • Report Description