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.
![]() |
|
![]() |
|
![]() |
|
![]() |
This article is the first of a series of articles... Read More
I completed an experiment recently. I wanted to find out... Read More
While paper labeling CDs and DVDs may appear to be... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
If you are in the market for new staffing software,... Read More
C/SIDE (Client/Server Integrated Development Environment) - The core of... Read More
There are several kinds of software piracy. The bottom line... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
eStore Advantage allows front-office applications to communicate with back-office business... Read More
If you are in a business that passes documents around... Read More
How to delete the user? This is the first problem... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Homeland security, airport security, Internet security â?" these days weâ??re... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
The various resume software offered, particularly on the internet, can... Read More
OEComplete is a utility for managing the personal information of... Read More
Microsoft Word is one of the most popular office applications... Read More
Microsoft Great Plains and Microsoft CRM become more and more... Read More
I have recently created my first Php program. I wanted... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
A few months back I really got sick of my... Read More
Some companies that are in need of fleet management may... Read More
Shareware is software that you can try before you buy;... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
Spyware is like the new technological nuclear weapon on the... Read More
Our hosted solution allow you to run your own search... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Microsoft Business Solutions Great Plains has I'd say end user... Read More
Since technology changes so quickly, it is hard to begin... Read More
How many steps does it take you to locate and... Read More
Every day millions of new web documents emerge on the... Read More
Google Inc. has launched a new software package that allows... Read More
If you have Microsoft Great Plains and support it for... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
Have you ever noticed that when you look at your... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
When Windows fails to boot it is normally caused by... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
1. What determines the software price? Is it Per Seat... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Imagine something that follows you home and sets itself up... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Words we choose to describe things and phenomena often show... Read More
IntroductionPHP can be used for a lot of different things,... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Enabling Chinese input is quick and easy, there are only... Read More
TikiWiki is open source software - it is written in... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
Accounts payable is just one area of office management where... Read More
When you need a phone number, you do a quick... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
Our opinion is based on our Microsoft Business Solutions Great... Read More
Security flaws have long plagued Internet Explorer (IE), the market-dominating... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
OEComplete is a utility for managing the personal information of... Read More
The first topic we are going to discuss... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Crystal Reports is the most flexible tool on the market... Read More
IntroductionDuring the early years of our modern computer era, very... Read More
Are you one of those people that keeps track of... Read More
Software |