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.
|
|
|
|
|
|
|
|
|
|
|


1. What determines the software price? Is it Per Seat... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Microsoft Great Plains is becoming more and more popular and... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
When you buy a computer, it most likely comes with... Read More
The first topic we are going to discuss... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
Corporate ERP/MRP selection might be tough one, especially considering very... Read More
SyncUp, a file synchronizer is designed to assist the home... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
The first thing that you will notice about Linux Red... Read More
When Great Plains Software was designing and developing Great Plains... Read More
We would like to give you pluses and minuses of... Read More
Our hosted solution allow you to run your own search... Read More
It won't matter how effective your WinRunner Team is if... Read More
Now is the time to look at an alternative to... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
Ok... Where to start?Well, I guess I will start at... Read More
Have you ever noticed that when you look at your... Read More
As we could imagine, if you are reading this article... Read More
Using professional icons in your application or website can bring... Read More
IntroductionPHP can be used for a lot of different things,... Read More
Great Plains Accounting, accounting package for mid-size and small companies... Read More
CD and DVD replication is a process that works by... Read More
The most important things you can do for your computer... Read More
Microsoft Business Solutions CRM is now approaching the phase of... Read More
Microsoft Word is one of the most popular office applications... Read More
One day, you suddenly realize that your computer started to... Read More
You might think you don't need a firewall... Read More
Looks like Microsoft Great Plains becomes more and more... Read More
There are two major WYSIWYG(What You See Is What You... Read More


In linux, one of great commands for finding out information... Read More
Homeland security, airport security, Internet security â?" these days weâ??re... Read More
... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
The major reason I recommend getting your hands on real... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
It is a well known fact that Java as a... Read More
Does Microsoft care for WebmastersIt's always been a problem with... Read More
The Windows Indexing Service provides you with the ability to... Read More
Most people understand that the "hardware" part of their computer... Read More
Microsoft Business Solutions Great Plains has Project Accounting module where... Read More
Microsoft Business Solutions ? Great Plains is designed to meet... Read More
I suggest that you do not spend a lot of... Read More
Traditionally we were considering functionally rich systems, such as SAP,... Read More
Google Inc. has launched a new software package that allows... Read More
So, you've bought a new Macintosh, and now you may... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
People often ask me: What image file formats will Photoshop... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
The title of "software engineer" has got to be among... Read More
Just imagine: you are walking, say, towards your car, and... Read More
If there still are few unprotected computers left, I haven't... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
The cornerstone of successful automated office systems is the ability... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
Microsoft Business Solutions Great Plains was purchased from Great Plains... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
Did you ever give a thought to the number of... Read More
What is RAID RECOVERY?RAID stands for Redundant Array of Inexpensive... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Software |