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/csharp/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 (http://www.codeproject.com/csharp/csmanagedeventsinkshooks.asp), he is Dexterity, SQL, VB/C#.Net, Crystal Reports and Microsoft CRM SDK developer.
Lincoln Stretch rentals Alsip ..Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
Whether you have used Microsoft Word for years, have just... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Great Plains Integration Manager scripting and translation - overview for... Read More
If you have Microsoft Great Plains and support it for... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
Microsoft Great Plains as ERP and Microsoft CRM as... Read More
I have always regretted how Microsoft price gouges and rips... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
If you are in a business that passes documents around... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Disclaimer: All the thoughts expressed are my views only! Your... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
Just imagine: you are walking, say, towards your car, and... Read More
TikiWiki is open source software - it is written in... Read More
If you've been using MySQL database to store your important... Read More
Corporate ERP/MRP selection might be tough one, especially considering very... Read More
Western Springs shuttle limo ..Navision Software was purchased by Microsoft and now it is... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
Heard about the Quark "killer"?Adobe InDesign CS2. Will it really... Read More
What is installation in the language of technology? Installation... Read More
If you copy something from a Web site or elsewhere...... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
SOFTWARE PIRACY We regularly hear reports... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
You turn on your computer, and it doesn't look quite... Read More
Blue Cross and Blue Shield of Hawaii (HMSA) found itself... Read More
TikiWiki is open source software - it is written in... Read More
Whether you are an experienced web programmer or a complete... Read More
Have you noticed WordPerfect is gearing up for a comeback... 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
Are Spreadsheets Robbing your Enterprise of Competitive Advantage?'90% of "average"... Read More
Vince Lombardi once said that, "The achievements of an organization... Read More
COMMAND LINE FUNCTIONA powerful command line script processor has been... Read More
Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
There are several kinds of software piracy. The bottom line... Read More
This article will not attempt to advocate the use of... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
Software |