views:

60

answers:

1

I have a SharePoint workflow with a SendEmail activity. I use the MethodInvoking event handler to set the To property.

However, sometimes the workflow should not try to send an e-mail, because there is no e-mail address. I can detect such a condition in the MethodInvoking event handler. Is it possible to skip the SendEmail activity and proceed to the next one?

I know I can put IfElseActivity before SendEmail, but I am looking for a way to cancel activity execution.

+1  A: 

From looking at the SDK, all activities have a Cancelling event. However, what I find seems to suggest that an activity is only cancelled if the entire workflow hits an error or is cancelled. It does not appear that you can manually cancel a single activity (I'm not sure the workflow would know what to do next). So an IfElse branch, or a ConditionedActivityGroup, would probably be your best shot.

ccomet