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.
![]() |
|
![]() |
|
![]() |
|
![]() |
A UNIX Shell is in simplest terms, a command line... Read More
The term "document management" and "paperless office" is the subject... Read More
The first thing that you will notice about Linux Red... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
Spyware and malware are large problems for Internet users today... Read More
Microsoft Great Plains fits to majority of horizontals and retail... Read More
Microsoft Word is one of the most popular office applications... Read More
Shareware has been fighting the stigma of being misunderstood for... Read More
When Windows fails to boot it is normally caused by... Read More
When you own a small business, time is money. And... Read More
Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More
When it comes to screenplay software each screenwriter needs to... Read More
2005 ? Back to the Future.What does the future hold?... Read More
Your computer cost you from hundreds to thousands of dollars,... Read More
Microsoft-Outlook is a pretty amazing program. So much more than... Read More
Cyberspace has opened up a new frontier with exciting possibilities... Read More
The purpose of Project Management Software is to provide an... Read More
We would like to give you several situations, when you... Read More
Words we choose to describe things and phenomena often show... Read More
We all already got used to computer monitoring both at... Read More
The most important things you can do for your computer... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
Have you ever noticed that when you look at your... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
Did you ever give a thought to the number of... Read More
Need software to record your voice, streaming audio or musical... Read More
Microsoft Business Solutions ? Navision is an integrated solution for... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
One of the things we can be as certain of... Read More
Midsize business or non-profit organization should decide if one-vendor solution... Read More
This article is the first of a series of articles... Read More
Many Webmasters have never bothered to view their website's server... Read More
When Windows fails to boot it is normally caused by... Read More
Microsoft Business Solutions Great Plains is very popular ERP platform... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Does Microsoft Have any Real Competition? Copyright (c) 2003 Gregory... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
C++ Function templates are those functions which can handle different... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
I have recently created my first Php program. I wanted... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions CRM is now approaching the phase of... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
SyncUp, a file synchronizer is designed to assist the home... Read More
Three highly respected names in Human Resources have joined forces... Read More
Sales are all about leverage, because there is only so... Read More
Microsoft Business Solutions Great Plains has Project Accounting module where... Read More
Itâ??s easy to understand why you might be drawn to... Read More
Microsoft CRM is winning market share step-by-step from such the... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
DBxtra is a powerful query and reporting tool that hides... Read More
If you are in the market for new staffing software,... Read More
Should one use Windows Update?This topic has good and valid... Read More
Microsoft CRM is relatively new player on the now becoming... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
If you company is small or mid-size special products or... Read More
GroupwareEfforts are continually made to manage the unavoidable ad hoc... Read More
Software |