I ran into an issue where hyperlinks in workflow task emails where being automatically changed by SharePoint from absolute hyperlinks to relative ones.
- You create a custom Visual Studio workflow and use the CreateTask activity.
- You set your SPWorkflowTaskProperties.Description property to some HTML text.
- 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).
- Example: “Please review <a href=”http://yourserver/site/lists/yourlist/dispform.aspx?ID=1”>contract #12345</a>”.
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.
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.