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 workflow with a send email activity following a code block. This is code block :

private void codeActivity2_ExecuteCode(object sender, EventArgs e)
{
    this.sendEmail2.To = "tom@mysite.co.uk";
    this.sendEmail2.From = "tom@mysite.co.uk";
    this.sendEmail2.Subject = "Expense Report Approved";
    this.sendEmail2.Body = "Your Expense Report:1";
} 

But no email gets sent and no error messages generated.

It works when I directly complete the same four fields in the properties of the send email activity (without code block)

Any ideas, do I need to submit the email when using code block? In the code I've tried without the 'this' command also.

share|improve this question
add comment

1 Answer

If you use code activity to set properties of send email activity, the email is sent when email activivty is executed. In this case you need to be sure that code activity is invoked first. You can create empty method for send email activity, put break point to this method and check what properties send email activity has.

share|improve this answer
    
Hi Do you mean ctraye a MethodInvoking within the Email Activity by double clicking activity and generating private void SendEmailResponse_MethodInvoking(object sender, EventArgs e) { } –  Raj Chahal Jan 11 '12 at 9:14
    
yes. in this case you can check the activity properties before this activity is executed. –  Alexander Jan 11 '12 at 9:30
add comment

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.