Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Listing Sharepoint documents with title and not name



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).


Aug 14, 2012 18:34

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.

Aug 15, 2012 8:50

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).

Aug 15, 2012 16:02

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;
            if (virtualFile.IsDirectory)
                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);


Aug 15, 2012 17:09

Thanks Sergii, exactly what I was after.

Aug 16, 2012 9:57
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.