How to edit email message sent by CreateTaskWithContentType activity? RRS feed

  • Question

  • I have created a custom document approval workflow in Visual Studio 2008. When workflow creates a task the approver gets a email created from the wrong template "A new Page Needs your Approval to add to MySite". Looks like message is coming from another workflow. But I create a task base on my custom content type. How to add email template for my workflow?

    Friday, May 20, 2011 8:13 PM


All replies

  • Hi Oleg,

    You can create a custom email with the SPUtility.SendEmail method, refer to,
    And there is a short article about the html format in email body, you can read it,

    Another way, you can create a custom email with sendEmailActivity, you can refer to this article,


    Thanks & Regards,

    • Marked as answer by Wayne Fan Friday, June 3, 2011 3:07 AM
    Tuesday, May 24, 2011 12:23 PM
  • Thank you for suggestion but this solution is not fix for my issue. I will use custom sendemail just if I will not have another choice.

    I have added to createApprovalTask_MethodInvoking:

          createFirstApprovalTask.TaskProperties.HasCustomEmailBody = true;
          createFirstApprovalTask.TaskProperties.EmailBody = "A new Document needs your Approval.";
          createFirstApprovalTask.TaskProperties.SendEmailNotification = true;

    but I still get a message from another workflow. Does HasCustomEmailBody actually work?

    Wednesday, May 25, 2011 8:34 PM
  • Did you set the value for "AsignTo"? If not you can add it and try it again.


    taskProperties.Title = "Approval";
    taskProperties.StartDate = DateTime.Today;
    taskProperties.PercentComplete = 0.0f;
    taskProperties.AssignedTo = username or groupname;

    • Marked as answer by Wayne Fan Friday, June 3, 2011 3:07 AM
    Friday, May 27, 2011 9:18 AM