Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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:

http://test-t.my-domain.com

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;
        }
share|improve this question
    
can you post part of the code that is getting the url? –  ali Sharepoint Mar 25 '13 at 11:58

1 Answer 1

try the following:

goto Include a hyperlink to the current item:

http://office.microsoft.com/en-us/sharepoint-designer-help/send-e-mail-in-a-workflow-HA010239042.aspx#BM5

someone posted this on the url you provided:

One way around this that I just found is that if you paste the URL and then press backspace at the end and let it clear the hyperlink, the email will still have the Link but it will be full absolute path

share|improve this answer
    
The first link is not relevant for me, because it is focused on workflows and tasks implementation in sharepoint designer. The second solution is also not relevant for the same reason. –  KHA Mar 25 '13 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.