Tag Archives: Reporting

Custom document reports using OOTB SharePoint

There is a useful feature of SharePoint that provides site collection wide reporting across documents (and items). I’m referring to ‘Site Content and Structure Reports’ and it allows you to view a handful of OOTB reports as well as create custom reports (al beit somewhat limited). You may not want to provide access to this page for many users but it can be a handy IT feature if nothing else. I have an example of a “documents checked out to any user” report at the end of this blog.

The Content and Structure page can be found under Site Settings in SharePoint 2013 [or in the Site Actions drop down in SharePoint 2010]
The Content and Structure page can be found under Site Settings in SharePoint 2013 [or in the Site Actions drop down in SharePoint 2010]

The default reports are listed in the next image and some can be quite useful like ‘Checked out to me’ and ‘My tasks’ although often a customised solution has more elegant approaches to displaying this information elsewhere. The good bit is that it is very easy to make your own assuming you know CAML.

The reports can be run using the View menu on the Content and Structure page
The reports can be run using the View menu on the Content and Structure page

There’s a link to the list of these report definitions from the site collection root site (/Reports%20List/AllItems.aspx). Here you can create new report definitions just by adding a new item to the list. You merely need to define the CAML which will then return results from every library/list in site collection.

The set of Content and Structure report items the come with SharePoint
The set of Content and Structure report items the come with SharePoint

As an example, I have created a new report to return all checked out documents no matter who they are checked out to by using the following CAML:
<Where><IsNotNull><FieldRef Name="CheckoutUser" LookupId="TRUE"/></IsNotNull></Where>

Report: Checked out to anyone
Report: Checked out to anyone

It is important to note that you should leave both of the ‘Resource Id’ column blank. If you populate these columns with valid resource Ids then the correspoding resources will overwrite the reports CAML and description.
Also if you would like to restrict the query to a specific sub-set of list types then you can use the ‘CAML List Type’ field to enter a list definition ID (a full list of the defaults can be found here) like so:
<Lists ServerTemplate="101"/>

Hope you found this useful.