Apr 09 2009

SharePoint May Break Hyperlinks in Workflow Task Emails

Category: SharePoint, TechnologyAdam Toth @ 11:54 am

I ran into an issue where hyperlinks in workflow task emails where being automatically changed by SharePoint from absolute hyperlinks to relative ones.

Scenario:

  1. You create a custom Visual Studio workflow and use the CreateTask activity.
  2. You set your SPWorkflowTaskProperties.Description property to some HTML text.
  3. In your Description HTML text, you have an html hyperlink <a> tag whose href=”” attribute contains an absolute hyperlink to a resource in the same SharePoint farm (i.e. a list item).
  4. Example: “Please review <a href=”http://yourserver/site/lists/yourlist/dispform.aspx?ID=1”>contract #12345</a>”.

Goal:

Users will receive the task email, and be able to click on the absolute URL in the email body to navigate to the SharePoint resource.

Problem:

It appears that SharePoint parses this HTML and readjusts the hyperlink and makes it relative.

Example: “Please review <a href=”/lists/yourlist/dispform.aspx?ID=1”>contract #12345</a>”

This effectively breaks the hyperlink in the email client.

The only workaround was to get rid of the <a> tag and write out the hyperlink in full. For example:

“Please review contract #12345 (http://yourserver/site/lists/yourlist/dispform.aspx?ID=1)”.

In this manner, SharePoint did not adjust the hyperlink at all.

Tags: , ,

2 Responses to “SharePoint May Break Hyperlinks in Workflow Task Emails”

  1. Gautam says:

    I am also having the same problem. Do you have a solution for this?

  2. 3m stock says:

    The core of your writing is neat and works well with me. Somewhere throughout the sentences you actually managed to make me a believer. I still need more information and would rather have you to create more as soon as you can. If you accomplish that, I would certainly be fascinated. I will pop in again to review your updates!

Leave a Reply