How to show file path inside a SharePoint Document Library view

I recently created a view in a document library that shows files modified in the last 30 days. We use a number of levels (folders) in this document library so I wanted to indicate in which folder a modified file was stored.

Here is how you can do this. This is an overkill for task as simple as this one, but it only solution I could think of. It works!

  1. Create a new single text line column in your library e.g. Path
  2. Fire up SharePoint Designer (2010 or 2013) and create a new List Workflow that fires when item is created

Here is how your workflow activities should look like:

Workflow Activities

 

Here is what this workflow does:

  1. Copies value from a hidden column Server Relative URL to a variable substring. Please note: we are omitting first 35 characters. These 35 leading characters are path to the document library and you will need to change this number to match your environment. In my case full Server Relative URL looks like this: /finance/invoices/Shared Documents/2013/05/URA/TeamViewer_552075866.pdf
    In this example step stores /2013/05/URA/TeamViewer_552075866.pdf to the substring variable.
  2. This step removes original filename from string. In my case result of this step is /2013/05/URA//.pdf (Please note: I have no idea how to replace something with an empty string in SharePoint Designer, so I am using “/” instead)
  3. This step replaces filetype with /, the result of this step is /2013/05/URA//./
  4. Replaces “//./” with single “/”. Final result is /2013/05/URA/
  5. This step updates original item, column Path, with the result of previous four steps

Hope this helps!


Comments

4 responses to “How to show file path inside a SharePoint Document Library view”

  1. Am I missing something? I can’t find the replace function from the middle 3 steps. Anywhere I should be looking?

  2. pipinz Avatar

    Where is the tie-in to the Path column in all this?

    I have replicated the column and workflow as mentioned above, but my Path column is not populating.

    I’ve tried various settings under Current Item (step #5’s link menu) – no luck yet.

  3. siddhaarth Avatar
    siddhaarth

    Thanks Toni.

    Hi Guyz..
    It will work after a slight modification.
    In step 5: then set Path to Variable: substring instead of update item in current item

  4. Have no option for Copy from in sharepoint online 2013 or 2010 workflows, is there something that needs to be enabled?