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. 

13 comments:

Anonymous said...

Hi, Thanks for the post. I couldn't get this working setting. I created a copy of V4.master and replaced the original value with the following :


Also, I don't know which property to set for setting the title. Need to replace the "Site Content" text to "My Studios"

Would really appreciate it. Thx

Anonymous said...

HTML Not displaying here

Anonymous said...

SharePoint:SPHierarchyDataSourceControl
runat="server"
id="TreeViewDataSource"
RootContextObject="Web"
IncludeDiscussionFolders="False"
ShowDocLibChildren="False"
ShowFolderChildren="False"
ShowListChildren="False"

Anonymous said...

I also couldn't get this to work. Is there something that needs to be done after we make the change? Because a simple page refresh doesn't do anything. Also, it should be noted that my v4.master file has two areas where SPHierarchyDataSourceControl appear. Which one should I be editing? Thanks!

Anonymous said...

Any response would be appreciated please?

Anonymous said...

This doesn't work with Team Site. It works from a blank site.

Binary Republik said...

Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful.
Sharepoint Consulting help to handle the storage like scanned images of incoming paper documents and their associated workflows. They help to create secure extranets for collaboration with clients.

Anonymous said...

Thank you very much for this post. The solution is correct.

Anonymous said...

With app page, really works, but I'm not getting the same result with the master. ideas?

Anonymous said...

Thanks! really helped.

Anonymous said...

for those having issues getting this to work, please see
http://support.microsoft.com/kb/2558891 (SharePoint 2010 sites that are not based on the Blank Site template will not honor the ShowDocLibChildren and ShowListChildren properties for the Tree View Control)

Anonymous said...

How did you rename the tree view? Also how did you add a second tree view?

Unknown said...

Aw, this was a very nice post. In concept I would like to put in writing like this additionally – taking time and actual effort to make a very good article… however what can I say… I procrastinate alot and under no circumstances seem to get something done. gsn casino games