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


Task Manager is a Windows system utility that displays thetasks... Read More
In the Clinton era the status quo was simple: you... Read More
MS CRM is very close to document workflow automation, including... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
Buying accounting software is a major investment. It's an important... Read More
Homeland security, airport security, Internet security â?" these days weâ??re... Read More
Looks like Microsoft Great Plains becomes more and more... Read More
Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
What is installation in the language of technology? Installation... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
(1) Avoid using the same variable again and again for... Read More
Former Great Plains Software Dynamics/eEnterprise and currently Microsoft Business Solutions... Read More
For those who are unclear on the differences between the... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Writing software manuals is boring, isn't it? We often think:... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
The most important things you can do for your computer... Read More
Are you lost in the mess of documents that get... Read More
The world of small business accounting software can be a... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
eStore Advantage allows front-office applications to communicate with back-office business... Read More
If you've been using MySQL database to store your important... Read More
Fundraising software lets you connect with donors in a way... Read More
Learning how to program software seems like a daunting task... Read More
If you use Microsoft Outlook (or similar applications) for e-mailing,... Read More
Disclaimer: All the thoughts expressed are my views only! Your... Read More
Following tips help you to learn a software in lesser... Read More
Let's first look at your ERP system selection (without Retail... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
DBxtra is a powerful query and reporting tool that hides... Read More


If your company has regional and worldwide operations, you might... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Microsoft Business Solutions Great Plains fits to majority of horizontal... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
The most important things you can do for your computer... Read More
With any good luck and a good amount of hard... Read More
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM... Read More
Navision Software was purchased by Microsoft and now it is... Read More
CD and DVD replication is a process that works by... Read More
A UNIX Shell is in simplest terms, a command line... Read More
When you double-click a layer in the Layer Palette, you... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More
We will base our prognosis on our Microsoft Business Solutions... Read More
Finally, you have some time to personalize your desktop with... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Words we choose to describe things and phenomena often show... Read More
Simply put, fleet maintenance allows companies to monitor and maintain... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
The US House of Representatives has recently passed the "Spy... Read More
What is Groupware?Have you ever had to manage document collaboration... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
Around the same time Microsoft made its move with .Net... Read More
When reading an article where some term is used often,... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Whether you are a small consultancy firm, a medium sized... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
Software |