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.
Features Additionally, Vista will include many other new features.Aero Vista... Read More
Microsoft Business Solutions Great Plains serves to the wide spectrum... Read More
A UNIX Shell is in simplest terms, a command line... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
We would like to give you pluses and minuses of... Read More
I completed an experiment recently. I wanted to find out... Read More
The objective for Zandi Digital is to make available clever... Read More
Fleet Maintenance Management is a critical position in any company... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Learning how to program software seems like a daunting task... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
The intentions of this short tutorial are not to teach... Read More
Microsoft Great Plains is one of three Microsoft Business Solutions... Read More
Assertion facility is added in J2SE 1.4. In order to... Read More
Microsoft Client Relation Management system (Microsoft CRM) and Microsoft RMS... Read More
We all take the computer for granted. I mean, all... Read More
I provide, here clear explanations and a count of function... Read More
Microsoft Business Solutions Great Plains might be considered as ERP... Read More
Almost all new and major brand of PCs come with... Read More
Microsoft Business Solutions ? Great Plains is designed to meet... Read More
The Internet is reshaping every form of communications medium, and... Read More
Once upon a time not so long ago, there was... Read More
Microsoft Business Solutions Great Plains is very popular ERP/MRP applications... Read More
Stealing company information used to be the specialty of spies... Read More
Mike Dunville* had a decision to make. As the new... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
Microsoft Great Plains fits to majority of horizontals and retail... Read More
Introduction To ISDN, Part III: Configuring PPP PAP AuthenticationNow we... Read More
ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More
Microsoft Business Solutions Great Plains was purchased from Great Plains... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
In the new era of internet marketing the problem of... Read More
Do you want to get quality software at a reasonable... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
According to a survey conducted by InfoTrends/CAP Ventures entitled "Content-Centric... Read More
Music downloads are off the charts! We're listening to digital... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Introduction: The creating of a computer program involves a number... Read More
Navision Software was purchased by Microsoft and now it is... Read More
Intro This concise article will tell you in plain English... Read More
Microsoft Business Solutions Great Plains might be considered as ERP... Read More
Mike Dunville* had a decision to make. As the new... Read More
Looking at all the ads which promise to get rid... Read More
Configuring PPP PAP AuthenticationNow we know how the ISDN link... Read More
If you've been using MySQL database to store your important... Read More
With thousands of web pages added to the Net every... Read More
When my daughter was getting into AOL instant messaging (AIM)... Read More
Microsoft Great Plains is one of the Microsoft Business Solutions... Read More
Anti-virus software is used to find, remove or fix files... Read More
Now that spyware is the single most dangerous threat to... Read More
The research in the field of Natural Language Processing usually... Read More
SyncUp, a file synchronizer is designed to assist the home... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
The major reason I recommend getting your hands on real... Read More
Each Industry and market niche has business specific and unique... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
Not every software testing project can or should be automated.... Read More
Remember back in the days where screensavers were the coolest... Read More
When Great Plains Software introduced the first graphical accounting application... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
IntroductionSurprised, by the title? well, this is a tour of... Read More
Software |