does anyone know how you can expose a sharepoint document title rather than the name? In a TreeNodeBinding (of a treeview control) you cannot set the TextField property to title (only the ToolTipField property) and in the code behind the VirtualFileBase class only has relevant methods for Name and VirtualPath when setting the text of each of the nodes (which overides the TextField property anyhow).
If you are using Connect for SharePoint and reading SharePoint documents over EPiServer.VirtualPathWssProvider, then you can try to cast VirtualFileBase to EPiServer.VirtualPathWssProvider.WssFile. WssFile has Summary property, that contains document metadata including Title.
Thanks for the reply Sergii.
No, I am just using the local CMS file storage (documents in this case) through a FileSystemDataSource control, bound to the treeview.
Having said that, the site on production server does read sharepoint docs over EPiServer.VirtualPathWssProvider, but either way I am working with the same episerver source code for the document listing (included in the template install). Also, looks like WssFile is not available to code against (greyed out in reflector).
Well, if you are using FileList user control from Alloy Tech sample templates - then take a look at FileTree_TreeNodeDataBound method in the control's code behind. It always sets the Text property of the tree node to the Name attribute value. You can updated it like this, in order to get Title instead of Name:
protected void FileTree_TreeNodeDataBound(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e)
VirtualFileBase virtualFile = e.Node.DataItem as VirtualFileBase;
string title = null;
e.Node.SelectAction = TreeNodeSelectAction.Expand;
e.Node.NavigateUrl = e.Node.DataPath;
var unifiedFile = virtualFile as UnifiedFile;
if (unifiedFile != null)
title = unifiedFile.Summary.Title;
e.Node.Text = Server.HtmlEncode(title ?? virtualFile.Name);
Thanks Sergii, exactly what I was after.