SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 = "";
    this.sendEmail2.From = "";
    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

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

Your Answer


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.