I have a sharepoint 2010 portal and have builded a custom workflow in VS2010. In this custom workflow I create a task and sete the title, description and assign it to a user. When this workflow is triggered by a new item, the user receive the mail about this task which is assigned to him. Everything is OK.
In this email there is the description with inside of it a hyperlink to the item in my list. I have implemented this explicit in my custom workflow in codebehind. The strange is, that SharePoint is stripping the domainname from the url in my a href. So for example:
This is my sharepoint domainname:
The hyperlink in the task description is as follow:
http://test-t.my-domain.com/sites/RFC/Lists/Wijzigingsverzoeken/DispForm.aspx?ID=5
The link inside the email after sharepoint has stripped :( the domain name is as follow:
sites/RFC/Lists/Wijzigingsverzoeken/DispForm.aspx?ID=5
I have googled around and found this blog with the same problem and some workarounds and solutions.
http://rrfreeman.blogspot.nl/2010/12/emailed-relative-html-rich-text-column.html
The workaround to use tinyurl is working, but is not the most beautiful. the other solutions I dont understand. Can someone please tell me how to resolve this problem? Maybe you understand the solutions in the blog.
The url: http://test-t.my-domain.com is an intern website. So it is not accessable outside the network of this company.
This is the code which creates the custom task with title, description and assign it:
private void createTaskAssessor_MethodInvoking(object sender, EventArgs e)
{
// Now create the approval task.
SPListItem currentItem = workflowProperties.Item;
ItemURL = currentItem.ParentList.DefaultDisplayFormUrl + "?ID=" + HttpUtility.UrlEncode(currentItem.ID.ToString());
ApprovalAssessorTaskId = Guid.NewGuid();
ApprovalAssessorTaskProperties.Description = string.Format("Er is een nieuw wijzigingsverzoek voor beoordeling <a href=\"{0}\">{1}</a>", GetCurrentItemUrl() + ItemURL, currentItem.Title);
ApprovalAssessorTaskProperties.Title = string.Format(Constants.Text.TEXT_STATUSCHANGED_ASSESSOR_TITLE, currentItem.Title);
ApprovalAssessorTaskProperties.AssignedTo = "Beoordelaar";
ApprovalAssessorTaskProperties.PercentComplete = 0;
ApprovalAssessorTaskProperties.StartDate = DateTime.Today;
ApprovalAssessorTaskProperties.DueDate = DateTime.Today;
ApprovalAssessorTaskProperties.EmailBody = ApprovalAssessorTaskProperties.Description;
ApprovalAssessorTaskProperties.SendEmailNotification = true;
}
private string GetCurrentItemUrl()
{
SPListItem currentItem = workflowProperties.Item;
Uri uri = new Uri(workflowProperties.WebUrl);
string prefix = "http://";
if (uri.Scheme == Uri.UriSchemeHttps)
{
prefix = "https://";
}
return prefix + uri.Host;
}