What is the best way to create a SharePoint tree view web part for a document library?


It is also possible to get the treeview with clientsidecode

Something like this

var context = SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle(listTitle);
context.executeQueryAsync(function () {
function (sender, args) {

then you have to make a createRoot function that inserts the html from the library tree when the user clicks. That depends that the tree is not expanded by default.



If you are looking for Out of the box way, you can use Grouping to achieve some level of Tree view..

But if you want folder wise structure as a complete Tree-view till n-levels, there is no Out of the box feature available. You will need to create a custom Web Part, already shown here:

Document Library Tree View Web Part for SharePoint


Add a Treeview to a Document LIbrary using SPTreeView and SPHierarchicalDataSource

  • I did grouping, but I don't think it is the best way to view the documents in the library. – Elena Apr 7 '14 at 21:08
  • Do I need to use Visual Studio for if I ll follow the first link instructions? – Elena Apr 7 '14 at 21:47
  • Yes, visual studio to develop a Visual Web Part.. – Arsalan Adam Khatri Apr 8 '14 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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