Microsoft CRM Customization: MS Exchange Transport SMTP Event Sink

Microsoft CRM Customization: MS Exchange Transport SMTP Event Sink

 by: Boris Makushkin

Microsoft CRM has variety of customizations options and tools. The official and the most popular is Microsoft CRM SDK: collection of C#.Net and partially VB.Net classes, methods and code samples. Here we would like to give you more complex case, when you call CRM SDK customization from custom MS Exchange event handler – we are improving the functionality of MS Exchange – MS CRM connector.

Imagine the case when you want outgoing email to be captured and placed into CRM, attached to Contact, Account or Lead they should belong to. If this is realized – your salespeople can use any email tool to send their messages, they do not have to do it in CRM or Outlook Client for CRM.

MS Exchange OnSyncSave database event can’t work with Sent folder – it doesn’t fire when message goes to Sent folder. The reason is described here:

PRB: Store Events Do Not Fire on the Outbox or Sent Item Folders

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q297274

Please, see SMTP Event Sink example in this article: http://support.microsoft.com/default.aspx?scid=kb;en-us;317327. Event handler works OnArrival event:

void ISMTPOnArrival.OnArrival(CDO.IMessage msg, ref CDO.CdoEventStatus EventStatus)

{

log = LogManager.GetLogger(typeof(ShieldsUp));

DOMConfigurator.Configure(new FileInfo(Environment.SystemDirectory + "/CustomerApp/log.config"));

try {

ProcessMessage(msg);

}

catch (Exception ex) {

log.Debug(ex.Message + " " + ex.StackTrace);

}

finally {

LogManager.Shutdown();

}

}

The class:

// ComVisible enables COM visibility of this class. The default is true.

// Explicitly setting this attribute to true, as shown below, is useful

// if ComVisible is set to false for the namespace and you want the

// classes to be accessible individually.

[ComVisible(true)]

public class ShieldsUp: CDO.ISMTPOnArrival

{

Next the handling works similar to SyncSave handler:

private void ProcessMessage(CDO.IMessage msg)

{

string sFrom;

string sTo;

string sSubject;

string sBody;

string sSensitivity;

try

{

log.Debug("Firing Up ProcessMessage()");

sSubject = msg.Subject;

sBody = msg.TextBody;

sFrom = msg.From;

sTo = msg.To;

if (msg.Fields["urn:schemas:mailheader:sensitivity"].Value != null)

sSensitivity = msg.Fields["urn:schemas:mailheader:sensitivity"].Value.ToString();

else

sSensitivity = "Normal";

log.Debug("Message From: " + sFrom);

log.Debug("Message To: " + sTo);

log.Debug("Subject: " + sSubject);

log.Debug("Sensitivity: " + sSensitivity);

log.Debug("Body: " + sBody);

In deployment you should consider the following – the handler will work only in the case of SMTP protocol delivery. If you use Outlook or Outlook Web Access, then delivery uses MAPI and OnArrival doesn’t fire. Please see this article: http://support.microsoft.com/default.aspx?scid=kb;en-us;273233

The elegant fix is two SMTP gateways, find it here http://support.microsoft.com/default.aspx?scid=kb;en-us;Q288756

About The Author

Boris Makushkin is Lead Developer in Alba Spectrum Technologies – USA nationwide Great Plains, Microsoft CRM customization company, based in Chicago, California, Colorado, Arizona, New York, Texas, Florida, Georgia and having locations in multiple states and internationally (www.albaspectrum.com), he is Microsoft CRM SDK, Transact SQL, C#.Net, Crystal Reports and VB.Net developer. Boris can be reached: 1-866-528-0577, borism@albaspectrum.com.

More Computers and The Internet and other resouces to help you locate great articles just like Microsoft CRM Customization: MS Exchange Transport SMTP Event Sink :

Here are other categories to find more must know information on anything and everything.
Auto and Trucks
Business and Finance
Computers and Internet
Education
Environment
Family
Food and Drink
Gadgets and Gizmos
Gardening
Government
Health
Hobbies
Home Improvement
Kids and Teens
Legal Matters
Marketing
Music and Entertainment
Online Business
Parenting
Pets and Animals
Recreation and Sports
Self Improvemen
Site Promotion
Travel and Leisure
Web Development
Women
Writing
Here are more Computers and The Internet articles to give you more must know information just like in Microsoft CRM Customization: MS Exchange Transport SMTP Event Sink article.

HTML Explained: Tips for Self-Starters
Want to save money while promoting your web-based business? Of course you do. Here's some advice on the matter, from a freelance copywriter who knows: it pays to learn the basics of HTML.

If you're like me (stubborn), you've probably been dodgin...
Read more


Protect Your Email Address
Spam only occurs when the spammer is able to get your email address. They have a variety of methods for doing this, some legal and some not.

Either way, the result is the same. You have become a
spam victim. The single most important action t...
Read more


6 Essential Steps to Protect Your Computer On the Internet For Free
Recently one of my friends asked me to check out if his computer was infected by virus. He suspected because occasionally the computer was shut down automatically when connected to internet. My first...
Read more


Internet Distribution: The Future of Entertainment.
A friend and I were having a discussion recently. I asked him what he thought the next method of distribution for films and music would be. My thoughts were that we would have to come up with some new method that was convenient, sturdy and didn't involve...
Read more


Personnel Security: What Is Your Security Posture?
1. The Security Consultant’s Perspective…

With Workplace Violence becoming an emerging concern, the
employee dimension becomes a critical factor in conducting
Vulnerability Threat Assessments against capabilities and
weaknesses, similar...
Read more


 

Thank you very much for viewing this must know article: Microsoft CRM Customization: MS Exchange Transport SMTP Event Sink . Hopefully you have found all the information you were looking for in " Microsoft CRM Customization: MS Exchange Transport SMTP Event Sink ". If you feel like you need more information feel free to check out Info Pom HOMEPAGE to look for more articles in our humangous database

Site Partners:
Background Check