Making the “Encoded absolute URL” work with a list in SharePoint

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”
Current Item > Path

Current Item > Path

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”
Current Item > ID

Current Item > ID

Now the URL in the email body will look like:
http://YOURSITENAME/[%Tasks:Path%]/DispForm.aspx?ID=[%Tasks:ID%]

Proper path to SharePoint list item

Proper path to SharePoint list item

 The email that will send out when the workflow is triggered will now look like:

Email with link to list item

Email with link to list item

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%]

  • In order to get a working link we will have to add “/../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 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!

    The paste text dialog box

    The Paste Text dialog box  in SharePoint Designer contains a few formatting options that allow you to paste text from other sources into your page.

    In this article we’ll explain what each option does.

    • Plain text ~ Pastes all text but replaces line breaks with spaces.
    • One <pre> formatted paragraph ~ Pastes all text within a single preformatted text <pre> tag
    • Many <pre> formatted paragraphs ~ Pastes each paragraph into seperate <pre> tags.
    • Normal paragraphs with line breaks ~ Pastes all text within a single paragraph tag.
    • Normal paragraphs without line breaks ~ Pastes each paragraph into a seperate paragraph tag.

    Paste or Paste Text

    • The paste option copies text along with the markup and styles (BAD!).
    • The Paste Text option launches the Paste Text dialog box, which pastes it without any markup an styles (GOOD!).

    Always try to use the Paste Text to prevent getting garbage markup styles polute your webpages which can be a tedious job to clean up.

    You can find the Paste Text option in SharePoint Design by clicking Edit → Paste Text.

    Add a new subsite using SharePoint Designer

    You can add a new subsite to your site collection using SharePoint Designer

    • Start SharePoint Designer
    • Select File → Open site (choose the site collection you want to open)
    • Select File → New
    • On the Dialog box that opens click the tab Web Site
    • Click on the link SharePoint Templates on the left and the list of available subsites will populate on the right.

    In case the SharePoint Templates don’t show up right away, ensure you enter the correct url in the box “Specify the location of the new Web site

    When creating the subsite you will have to specify the location for the new Web site.

    This could be something like: http://litwaredemo/MyNewBlog.

    Add a site with SharePoint Designer

    Add a site with SharePoint Designer

    Open a SharePoint Site with SharePoint Designer

    It’s easy to open a SharePoint site in SharePoint Designer.

    • Start SharePoint Designer
    • Select File → Open site

    In the Site name text box enter the URL of the site you want to open.

    For our example we will open  the main SharePoint site: http://litwaredemo/