The purpose of one of our projects was MS Exchange handler for processing incoming email.
The basic source of knowledge was this article "Developing Managed Event Sinks/Hooks for Exchange Server Store using C#" by Logu Krishnan, published to the address http://www.codeproject.com/csh arp/CsManagedEventSinksHooks.asp, and also examples from Microsoft Exchange SDK.
We utilized Synchronous Events and created the handler, which fires on OnSyncSave event. The handler creates activity record in Microsoft CRM and then removes the message in the Exchange database before the commitment:
public void OnSyncSave(IExStoreEventInfo pEventInfo, string bstrURLItem, int IFlags) { try { if (IFlags == ((int)EVT_SINK_FLAGS.EVT_SYNC_COMMITTED + (int)EVT_SINK_FLAGS.EVT_IS_DELIVERED)) {
ProcessMessage(pEventInfo, bstrURLItem, IFlags);
}
}
catch (Exception ex) {
log.Debug(ex.Message + " " + ex.StackTrace);
}
finally {
LogManager.Shutdown();
} }
For Exchange handlers debugging - it is the extremely convenient to use system log4net in RollingLogFileAppender or RemoteAppender modes (for multiple instance of COM + objects). You can read more on this subject here http://logging.apache.org/log4net/ To allow the handler incoming mail removal, it is necessary to give proper rights to the user, under which account the COM+ application runs the handler. These are rights on change of the information in user's boxes for whom it is registered (Windows 2003 Server: Active Directory Users and Computer -> Users -> Properties (for COM+ application account) -> Exchange Advanced -> Mailbox Rights). And now the code:
private void DeleteMessage(string bstrURLItem) { try {
ADODB.Connection oCn = new ADODB.Connection();
oCn.Provider = "exoledb.datasource";
oCn.Open(bstrURLItem, "", "", -1);
if(oCn.State == 1) {
log.Debug("Good Connection");
}
else {
log.Debug("Bad Connection");
}
ADODB.Record rec = new ADODB.Record();
rec.Open(bstrURLItem, oCn,
ADODB.ConnectModeEnum.adModeReadWrite,
ADODB.RecordCreateOptionsEnum.adFailIfNotExi sts,
ADODB.RecordOpenOptionsEnum.adOpenSource,
"", "");
rec.DeleteRecord(bstrURLItem, false);
rec.Close();
oCn.Close();
rec = null;
oCn = null;
}
catch (Exception ex) {
log.Debug(ex.Message + " " + ex.StackTrace);
} }
Happy customizing! Boris Makushkin
Boris Makushkin is Software Engineer in Alba Spectrum Technologies ? USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, Boston, San Francisco, San Diego, Los Angeles, Houston, Atlanta, New York, and Miami and having locations in multiple states and internationally (www.albaspectrum.com), he is Dexterity, SQL, VB/C#.Net, Crystal Reports and Microsoft CRM SDK developer.
![]() |
|
![]() |
|
![]() |
|
![]() |
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
1. With mapping software you can create a report that... Read More
When you double-click a layer in the Layer Palette, you... Read More
Introduction To ISDN, Part III: Configuring PPP PAP AuthenticationNow we... Read More
Scrapbooks are very popular these days. I think that almost... Read More
Microsoft Business Solutions Great Plains is written in Great Plains... Read More
I've been active in the Cisco Certification track for four... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
Are you a whiz at calculating financial information? Not the... Read More
GroupwareEfforts are continually made to manage the unavoidable ad hoc... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
In part III of this ISDN primer, we learned that... Read More
Microsoft Great Plains is one of three Microsoft Business Solutions... Read More
Crystal Reports is the most flexible tool on the market... Read More
Hey Guys! Don't raise your eyebrows or fear by hearing... Read More
IntroductionDuring the early years of our modern computer era, very... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
You might think you don't need a firewall... Read More
This is a short article, written in question/answer/FAQ style to... Read More
(1) Avoid using the same variable again and again for... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Since technology changes so quickly, it is hard to begin... Read More
When it comes to screenplay software each screenwriter needs to... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
Navision Software was purchased by Microsoft and now it is... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
So, why should you use any O/R mapping tool? I... Read More
CD and DVD replication is a process that works by... Read More
Since Version 8.0 Microsoft Business Solutions Great Plains & Great... Read More
If you feel intimidated when someone tries to teach you... Read More
It's all about turn times in the eMedia industry! The... Read More
When making a decision to buy any piece of software... Read More
Microsoft Business Solutions Great Plains, Navision, Axapta, Solomon and CRM... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
The adware and spyware definitions list is very long. But... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
I love new technology. I am still ready to wait... Read More
You probably didn't casually invite, or extend a formal attendance... Read More
In the new era of internet marketing the problem of... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
Microsoft CRM is now on the scene and it is... Read More
Itâ??s easy to understand why you might be drawn to... Read More
Following tips help you to learn a software in lesser... Read More
There are plenty of articles out there about how to... Read More
Scrapbooks are very popular these days. I think that almost... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
If you would like to pick something from Microsoft, or... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Remember back in the days where screensavers were the coolest... Read More
Every day millions of new web documents emerge on the... Read More
Whether you are an experienced web programmer or a complete... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
So let's begin crunching down these 300 images using Adobe... Read More
Usually workflow & messaging is realized in CRM and then... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
If you are to buy a HelpDesk & Asset Management... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
Trying to figure out a stream in banning one email... Read More
During the years of our consulting practice, which comes back... Read More
Software |