Monday, January 10, 2011

Customizing SharePoint 2010 Tree View Navigation

In Site Settings->Tree View, you can check "Enable Tree View" and you have this nice control that gives you all sorts of drill down links to sites and content within them.  Here is an example of three projects that I have listed under my Projects site and what the default view is:


But what if you want to customize what is displayed and what isn't. In order to modify this, you have to change the master page and find the SPHierarchyDataSourceControl node.  There are some options that you can choose from documented here: http://msdn.microsoft.com/en-us/library/ms439089.aspx


   IncludeDiscussionFolders="false" 
   ShowDocLibChildren="false"
   ShowFolderChildren="false"
   ShowListChildren="false"


You can even change the title of what is displayed here.  I chose to change the title to Current Projects.
Since the SPHierarchyDataSourceControl also has a "RootWebId" member that can be changed, I can move all archived projects to a new location and create another tree control that pulls from that root.  This will give me the ability to display Current and Archived Projects to users.