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”
In the pane that opens you can enter in a title and other Meta data.
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:
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.
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.
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?
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.
Thanks Alan
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.
@Jacob Thats a good solution as well. Does the workflow only run on item creation or on change as well?
Hi Dave – sorry for the late reply. The workflow fires on both creation and change, so the link column should always reflect the current title and filename.
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.
You may be able to do something like this using a calculated column. Like the examples here http://sharepointwijzer.nl/sharepoint-blog/tech/icc-html-calculated-column-sharepoint-view/