Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

This question already has an answer here:

I am trying to display only Document Libraries using SPTreeView control. I am providing SPHierarchyDataSourceControl with ShowDocLibChildrent = true as a datasource to spTreeView control.

But this shows all the document libraries. I want to show document libraries with specific content types only. How can filter out document libs with specific content type on SPHierarchyDataSourceControl or spTreeView?

share|improve this question

marked as duplicate by SPDoctor Feb 16 '13 at 14:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

You can create your own custom data provider for the treeview control and then use something like the additionalpagehead delegate control to instantiate it and set it as the datasource for the treeview.

Here is an example of creating a custom site map provider: http://www.codeproject.com/Articles/96461/Building-a-Custom-Site-Map-Provider

Here is an example of using the additionalpagehead control: http://www.sharepointjohn.com/sharepoint-2010-programmatically-add-javascript-meta-tags-and-css-styles-to-the-header-of-every-page/

And all you'd need to do with the TreeView control itself is:

WebTreeView.DataSourceID = null;
WebTreeView.DataSource = yourcustomsource;
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.