You’ve probably noticed that when trying to use the “Encoded Absolute URL” in for example an email that gets sent out from a workflow on a SharePoint list, returns a strange link that doesn’t work when clicking on it.
The URL that gets created when using the “Encoded Absolute URL” looks something like: http://litwaredemo/Project/Lists/Projects/14 .000.
The catch with the “Encoded Absolute URL” parameter is that it only works with Document Libraries – not with any other lists in SharePoint.
There are a couple of easy way around this by changing the URL a bit.
- Option 1 is the best approach, however you will have to hardcode the server name and this could cause the workflow or other to break when you move servers / domains (not very likely to happen very often though).
- Option 2 is a straight forward approach which doesnt’ make it necessary to hardcode the server name however has the downside that it will NOT work when using folders inside the list where list items are located.
Option 1: Hard coded server name – best option
When you created a workflow and as an action kick off an email, you can use the “Add Lookup to Body” functionality to compile the link.
In the body of the email type in:
http://YOURSITENAME/
- Click the “Add Lookup to Body” button
- For the drop down list “Source” select “Current Item”
- For the drop downlist “Field” select “Path”
- Click “OK”
Now the URL in the email body will look like:
http://YOURSITENAME/[%Tasks:Path%]
- Enter the text ”/DispForm.aspx?ID=” behind the just inserted parameter
- Click the “Add Lookup to Body” button again
- For the drop down list “Source” select “Current Item”
- For the drop downlist “Field” select “ID”
- Click “OK”
Now the URL in the email body will look like:
http://YOURSITENAME/[%Tasks:Path%]/DispForm.aspx?ID=[%Tasks:ID%]
The email that will send out when the workflow is triggered will now look like:
Option 2: Using [%Tasks:Encoded Absolute URL%]
When you created a workflow and as an action kick off an email, you can use the “Add Lookup to Body” functionality to compile the link.
In the body of the email:
- Click the “Add Lookup to Body” button
- For the drop down list “Source” select “Current Item”
- For the drop downlist “Field” select “Encoded Absolute URL”
- Click “OK”
Now the following parameter in the email body will look like:
[%Tasks:Encoded Absolute URL%]
Now the link in the email body is complete and will look like:
[%Tasks:Encoded Absolute URL%]/../DispForm.aspx?ID=[%Tasks:ID%]
The trick is the /../ between the “[%Tasks:Encoded Absolute URL%]” and the “DispForm.aspx?ID=[%Tasks:ID%]” in the link. The “/../” tells the server to go up one level in the folder hierarchy. The problem with this approach is that when you have folders inside your list where you store list items the path to the needs to go up even more levels depending on how deep you nested the list items.
I recommend using option 1 – but if you are absolutely certain folders will never be used or you will always keep all tasks organized on one specific folder level – this option will be ‘ok’.
And we are done!
See our follow up post about creating a nicer looking hyperlink instead of the url.
Hope this helps!












