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.
![]() |
|
![]() |
|
![]() |
|
![]() |
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
Google Inc. has launched a new software package that allows... Read More
Since technology changes so quickly, it is hard to begin... Read More
One of the things we can be as certain of... Read More
This is intermediate level SQL scripting article for DB Administrator,... Read More
Before September 1995, Microsoft Windows was an MS-DOS program. DOS... Read More
Does Microsoft Have any Real Competition? Copyright (c) 2003 Gregory... Read More
Small can be beautiful! Working with Knoppix for the past... Read More
XML parser is a software module to read documents and... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
There are so many different programs that clutter up your... Read More
Best Software Act! is very popular CRM for small and... Read More
Is your PC is slow and wimpy? Then you need... Read More
Simply put, fleet maintenance allows companies to monitor and maintain... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
How to delete the user? This is the first problem... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Research bears that less than 70 percent of development projects... Read More
Cyberspace has opened up a new frontier with exciting possibilities... Read More
Heard about the Quark "killer"?Adobe InDesign CS2. Will it really... Read More
Since its release in 1987, QuarkXpress had made an immediate... Read More
Microsoft Great Plains, former Great Plains Software Dynamics / eEnterprise... Read More
Almost all new and major brand of PCs come with... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
The Windows Indexing Service provides you with the ability to... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
Microsoft CRM is winning market share step-by-step from such the... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
All your software is stored on a hard-drive. But how... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
We would like to give you pluses and minuses of... Read More
Since technology changes so quickly, it is hard to begin... Read More
Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
Microsoft Great Plains, former Great Plains Software Dynamics / eEnterprise... Read More
The fact that a software tester is a most infamous... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
So, you've bought a new Macintosh, and now you may... Read More
Features Additionally, Vista will include many other new features.Aero Vista... Read More
Enabling Chinese input is quick and easy, there are only... Read More
If you are software developer or database administrator - we... Read More
What is Groupware?Have you ever had to manage document collaboration... Read More
The stakes are high when considering security, privacy, and savings,... Read More
Microsoft Great Plains may be recommended for international freight forwarding... Read More
We don't think about mainframe software pricing anymore, we just... Read More
Microsoft Retail Management System serves retail single store as well... Read More
It is really interesting that a bug can create problem... Read More
So, why should you use any O/R mapping tool? I... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
In linux, one of great commands for finding out information... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
Bar charts, bar graphs, and any other chart or graph... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Just when you thought you were Web savvy, one more... Read More
Microsoft Office program is a programming tool called Visual Basic... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
After almost two decades of existence, Quark has become the... Read More
Microsoft Business Solutions Great Plains has Project Accounting module where... Read More
Microsoft-Outlook is a pretty amazing program. So much more than... Read More
Pirated software is on the increase and now accounts for... Read More
People often ask me: What image file formats will Photoshop... Read More
Software |