Dynamics CRM - Programmatically Block Outbound Emails
Time for another crm goodie...
We've been working
on a little project that needed blocking of certain outbound
emails, with the Dynamics CRM plugin architecture this made
it very very simple. For whatever reason, if you want to
block outbound emails from Dynamics CRM programmatically,
hook into the Send message on the
email entity at the
Pre stage synchronously
then set the IssueSend property to
false.
A bit of code
if
(context.MessageName.Equals("Send",
StringComparison.InvariantCultureIgnoreCase))
{
context.InputParameters["IssueSend"] =
false;
}
A
little gotcha, the system marks the email as
Sent even though we've blocked it, so be
careful with that one. Hopefully this is useful to someone
else. We've used this technique to write a neat little addon
for Dynamics CRM, keep an eye out for it!