Displaying document titles as links.

On a recent project I had to migrate a large number of documents from a legacy system into SharePoint. In the old system users to choose what text would be displayed as the link. In most cases users chose not to use the actual file name as the link text.

The Problem

In SharePoint users don’t have as much control of what gets displayed. There is a ‘Title’ field but it can’t be used in a calculated column and on the standard document library it is not a required field.

Technically the file name could be used but this could lead to very long file names with spaces and special characters that could cause problems by forcing the page to scroll as well as creating some REALLY long URLs.

Depending on the type of document the actual file name may be irrelevant to the use while the title would be more helpful. For instance a in document library of meeting minutes the file names could just be the date of the meeting for example (12_03_2009.docx). The document title could be used to contain not only the date but other relevant information about the meeting like who attended or important issues that were discussed. Additionally the title field can support special characters and spaces that could be a problem in file names.

My Solution

I added two new columns to the Document Library.

  • “DocSrc” – a plain text column to hold the path to the document.
  • “Title Link” – a calculated column to create the link (I will explain this later).

First we need make sure our documents have titles.

Here is how to add Titles to a document in Word 2007:
Click on the ‘orb’ and choose “Prepare” > “Properties”
title1
In the pane that opens you can enter in a title and other Meta data.
title2

Now if a user uploads a document without a title we need to let them know and ask them to add a title.

Next I created a simple SharePoint Designer workflow, here is how.
Create a new workflow in SharePoint Designer and give it a name. On the first screen I checked these two boxes:

Allow the workflow to be started manually.
Allow the workflow to be started manually.

This is because we want the workflow to run for new items but just in case some items have already been loaded in the library we need to be able to run the workflow on them as well. In step 1 of the workflow I check to see if the “Title” field is empty, if it is not I copy the value from the “URL Path” field into my “DocSrc” field. I also added a condition so that if there is nothing in the “Title” field the workflow will email the user and ask them to add a title. In the body of the email I provide a link to the document. That’s all we need for the workflow.

wf5
 

Building the link

So now we have the title of the document and the URL of the document we can build our link in the “Title Link” column. We need to create a formula in the “Title Link” column that will create a link to our document and use the title as the displayed text.
In the “Title Link” column we just need to put the following text:

=CONCATENATE("<a href="',[DocSrc],'">",[Title],"</a>")

Next we just need to make the html code display properly using this script from Path to SharePoint.

Now users can see meaningful titles for thier documents without having to decifer complex document names and they will still have access to see the document name with the dropdown menu.

 wf5

When it comes to document management and getting new SharePoint users on board things like this are important in helping them feel more comfortable. If you dont take steps to make the system suit the users needs they are more likely to just use SharePoint as a new shared drive and just dump all their documents into a library that never get used.

Has anyone else dealt with this type issue? What was your solution?

davecavins

Dave is a SharePoint developer and graphic designer based in the DC area.

10 thoughts on “Displaying document titles as links.

  1. Thanks for the post…not being able to natively use a title column as a link to the document in a library seemed, to me, to be a gross oversight on functionality that MOSS/WSS should provide OOB. Your solution is one that will allow me to provide my users with increased UX and a more logical link name. Kudos.

  2. I had a similar request and here is the solution I used (no need for the HTML script this way):

    – Made the Title column required
    – Made a normal Link column called “Document Link”
    – Used a workflow to set the two values of the “Document Link” field, using the Title column as the description and the item URL as the address.

    Now we have a field value we can reference that is automatically a link to the document but uses the title instead of the name.

    1. Hello Jacob,
      I know it’s been a long time, but would you be willing to explain in more detail how you accomplished this?

  3. Is there any way to do this (or something similar – that is – change what is used as the hyperlink) without using sharepoint designer? I only have SPD 2010 but Sharepoint Online isn’t compatible.

  4. Great solution, but you got wrong formula format. I tried it, but SharePoint takes me an error message. Correct formula is:
    =CONCATENATE(““&NazovRiesenia&”“)

    Then you must set: The data type returned from this formula is: Number

    Enjoy! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *