Showing Child-Items Count in hierarchical SharePoint Lists with multiple content-types

SharePoint 2007 introduced content-types to template standard record definitions and re-use them across lists, such as Task, Issue, or even Folder. Multiple such content-types can be set associated to a single list. A folder is a content-type as well, and it can not only have child items/files within it but also have extended columns just like any item. This allows interesting scenario's where-by instead of using Lookups to setup relationship of items spread across lists one can implicitly set master-detail relationship on items within same lists.

I want to share how can you show the number of items within such folder (or master item!) without actually opening it. This is often useful when you want to give a view to users or have compute column at Master level without going deep into Details level.


This is a column in SharePoint database that keeps track of child items to a folder. When building a custom list definition or to an existing list, you can update list schema to include custom Field that is a lookup to ItemChildCount. Syntax is:

   2:      Name="ItemChildCount" 
   3:      DisplayName="# of Items"
   4:      DisplaceOnUpgrade="TRUE" 
   5:      SourceID="" 
   6:      StaticName="ItemChildCount" 
   7:      Group="_Hidden" 
   8:      ReadOnly="TRUE" 
   9:      Filterable="FALSE" 
  10:      Sortable="FALSE" 
  11:      Hidden="FALSE" 
  12:      Type="Lookup" 
  13:      List="Docs" 
  14:      FieldRef="ID" 
  15:      ShowField="ItemChildCount"
  16:      JoinColName="DoclibRowId" JoinRowOrdinal="0" JoinType="INNER" />

Above should be included in Schema.xml of your list definition, or you can update existing list by object model. If you do not have access to deploy code on your SharePoint site, say in a corporate Intranet setup, you can still update your custom list schema by Web Service by adding above field.

In a future post I'll share some details on enabling various scenario's by use of multiple content-types within same list, and its usability benefits on SharePoint sites.

-- Sharad


  • Shara, I'm trying to implement this column in the default doclib. Is there anything I have to do besides add this to the schema.xml ?

  • You have to manually add the new column to your View. New column is only available via View and can't be removed from UI.


  • Its not at all working

  • Hi

    Great Post !!

    Works fatastic for me.

    I also tried using FolderChildCount column in the table but getting an exception there as "can not complete this action".

    Any ideas?

  • sorry its working, can you tell how to get the FolderItemCount ?
    help is appreciated

  • Can anybody guide me how to do this exactly with steps or screenshots..

    Thanks in advance

  • Sorry to resurrect an old thread but I have a need for this item and I don't have access to install code on the server(corporate intranet setup). Sharad mentions you still can update your custom list schema by Web Service. Where/how do you do that?

    Any help MUCH appreciated, thanks in advance,


  • Hi can some one tell me what guid value i have to add to the Field ID="{REPLACE YOUR GUID HERE}" and if i have to get from the database which table i have to hit

  • I thik this already been asked, but I don't understand. I am "in a corporate Intranet setup" but don't know where or how I'd add the "above field." Would this be done in SharePoint Designer?

Comments have been disabled for this content.