开发者

Is it possible to cancel a workflow activity in the MethodInvoking event handler?

开发者 https://www.devze.com 2022-12-27 12:42 出处:网络
I have a SharePoint workflow with a SendEmail activity. I use the MethodInvoking开发者_StackOverflow event handler to set the To property.

I have a SharePoint workflow with a SendEmail activity. I use the MethodInvoking开发者_StackOverflow 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消