I get this message for every task assigned in my workflow, but I know the "offending code" that causes this error. Generally, it is code that copies data from the filled-out initialization form into a task's ExtendedProperties (which will show up in the custom task form). (Also note that the custom Task form has all the same fields as the Initialization form, plus some. I copied and pasted the fields from the Initialization template to the Task template when desiging in InfoPath.)
Specifically, in an initialization routine called within onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e), I have several lines that look like the following:
"] = parsedInitData.MyFieldName ;
- taskProperties is a new SPWorkflowTaskProperties object to which MyCustomActivity.CreateTask_TaskProperties is assigned.
- parsedInitData contains the data placed in the Initialization form that kicks off the workflow.
- MyFieldName is the name of a field in said initialization form template, thus also a form in parsedInitData.
- Most commonly of all, use a custom code activity to send an email. There are 2 variations:
-the more conventional way, via your own SMTP server, not even using SP to send the email in any way.
-calling the following function:
SPUtility.SendEmail(SPWeb Web, bool fAppendHtmlTag, bool fHtmlEncode, string to, string subject, string htmlbody)(http://forums.msdn.microsoft.com/en-US/sharepointworkflow/thread/22f41ab8-4f8b-4e19-8752-faaa1ca19b07/)
- If the problem is only with Tasks that won't send email rather than SendEmail activities per se, then use SendEmail activities instead (http://forums.msdn.microsoft.com/en-US/sharepointworkflow/thread/6e848a25-019d-4220-aff6-c535da933e0f/).
- Use a Sequential workflow rather than a State Machine workflow (http://forums.msdn.microsoft.com/en-US/sharepointworkflow/thread/6e848a25-019d-4220-aff6-c535da933e0f/).
- Bind all the necessary Properties to some variable in VS's Properties window while using Workflow Designer instead of setting them in code (e.g. MyCustomActivity.SendEmailActivity.Subject = "The Subject") (http://spschris.blogspot.com/2008/03/e-mail-message-cannot-be-sent-make-sure.html)
- (My favorite!) Who needs abstraction? Open Pandora's box by moving all SendEmail activities out of your custom composite activities and into your Workflow (at the top level). (http://forums.msdn.microsoft.com/en-US/sharepointworkflow/thread/22f41ab8-4f8b-4e19-8752-faaa1ca19b07/)