Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/a26f9f83/public_html/articles/includes/config.php on line 159
Removing Incoming Email in MS Exchange, C# Example > NetSparsh - Viral Content you Love & Share

Removing Incoming Email in MS Exchange, C# Example

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


} }

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 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.RecordCreateOptionsEnum.adFailIfNotExi sts,


"", "");

rec.DeleteRecord(bstrURLItem, false);



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 (, he is Dexterity, SQL, VB/C#.Net, Crystal Reports and Microsoft CRM SDK developer.

In The News:

This RSS feed URL is deprecated, please update. New URLs can be found in the footers at


This Call May Be Monitored for Tone and Emotion
We all know how it feels to be low on energy at the end of a long work day. Some call-center agents at insurer MetLife are watched over by software that knows how it sounds. A program called Cogito presents a cheery notification when the toll of hours ...

Oracle stock falls as earnings, outlook fuel doubts about cloud software growth
Oracle Corp. shares declined in the extended session Monday after the enterprise software company's quarterly earnings report and forecast did not show the cloud-software growth Wall Street expected. Oracle ORCL, -0.61% shares fell 3.7% in immediate ...

and more »


How Software Maker Tableau Helps Doctors Tame Data
Aaron Black calls it “hand-to-hand combat”: the time-consuming, painful battle to convert a Tower of Babel of information into life-saving guidance for doctors and researchers. Black is chief data officer at the Inova Translational Medical Institute, a ...


AI is becoming ubiquitous across enterprise software
This week at IBM Think, it will be difficult if not impossible to avoid the glare of artificial intelligence. With Watson, IBM has bet its reboot on AI. And with attention has come market pressure to make AI more accessible. We posted several months ...

MetroNews Canada

BlackBerry gains after announcing software expansion, Microsoft partnership
BlackBerry Ltd. BB, -1.78% shares gained in late trading Monday after the company announced an expansion of its security-software gambit that includes a new partnership with Microsoft Corp. MSFT, -1.81% BlackBerry detailed plans for BlackBerry Secure ...
BlackBerry says new software bridge to Microsoft products will increase securityMetroNews Canada

all 14 news articles »

Drone DJ

Software update for the Skydio R1 drone
Drone DJ
Skydio just came out with their fully autonomous R1 drone a few weeks ago and here is the first software update. Some of the improvements include short processing time of the video footage after flights, automatically attempt to reconnect in case of a ...


UK software firm Micro Focus suffers share price collapse
The company added it was grappling with the impact of its recent $8.8 billion (7.2 billion euro) purchase of software assets of Hewlett Packard Enterprise (HPE). The deal was completed last September. Micro Focus added that boss Chris Hsu, a former HPE ...
A firm bought assets from Hewlett Packard Enterprise. Its CEO has now quit and shares are tankingCNBC
Micro Focus value halves after warning on revenueThe Times
Shares of software giant Micro Focus plummet 46 percent as CEO Chris Hsu quitsSiliconANGLE News (blog)
The Guardian
all 82 news articles »

Pirelli using new software to spice up F1 strategies in 2018
Pirelli has developed new software to help it choose race-by-race Formula 1 tyre compounds in order to encourage two pit stops per event, and give teams more strategy options. The Italian company is using simulations to find the best combination of ...
Pirelli using new software to spice up F1, Edition: Global

all 2 news articles »


Xilinx debuts software programmable chip design in data center push
This enables a fundamentally different software centric design flow since all of the connectivity infrastructure is natively software programmable." Xilinx CEO Victor Peng explained that the company's past products have all had some level of ...
FPGA maker Xilinx aims range of software-programmable chips at data centersNetwork World

all 19 news articles »


Tesla Autopilot keeps impressing owners with its latest software update
Now the update has reached more Tesla owners and they have been able to test the new software more thoroughly – giving us a better look at the latest version of Autopilot. Home Solar Power. The update works on Autopilot 2.0/2.5 cars and owners who ...

and more »
Google News

HelpDesk & Asset Management Software - Choosing The Right One

If you are to buy a HelpDesk & Asset Management... Read More

The XP Firewall Isnt Enough

You might think you don't need a firewall... Read More

Microsoft Great Plains Upgrade ? Things to Consider and FAQ

If you have Microsoft Great Plains and support it for... Read More

Open Source Concepts: Dual Licensing Explained

We were recently faced with a decision: either to let... Read More

Who?s Watching What You Type?

If someone entered your home, uninvited and installed numerous cameras... Read More

Protect Your Most Vital Business Asset with Security Software

Homeland security, airport security, Internet security â?" these days weâ??re... Read More

Microsoft CRM ? Typical Customizations

Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More

Microsoft Great Plains: Offshore Customization & Development ? Overview for Consultant

When you visit department stores and see that majority of... Read More

Windows Screensavers Explained

In this article you will find some background information about... Read More

Understanding XML Server

XML Server can be a Web Server that stores the... Read More

Interactive Mapping Brings Information to Life

What is Interactive Mapping?Interactive mapping is a visual display medium... Read More

Microsoft CRM ? Consulting in the Post-Recession Time

New post-recession era has new features, which didn't exist in... Read More

Reduce TCO: The Java Database Way

TCO (Total Cost Ownership) is the buzzword in... Read More

Artificial Intelligence And Intuition

The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More

DVD Burning Tips

CD and DVD replication is a process that works by... Read More

String in Java

Handling character strings in Java is supported through two final... Read More

Microsoft RMS ? Great Plains Integration ? Overview For IT Specialist

Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More

Microsoft Great Plains Integration Manager ? Working With Text File

Microsoft Business Solutions main middle market ERP application - Microsoft... Read More

COSMIC: A Small Improvement on the Symons Method

The COSMIC FP (function point) software quality metric, is no... Read More

Your Computer May Be Infected, Heres How To Check (NOT about virus)

NOTE: Please take time to read on - it may... Read More

Configure Windows Indexing Service for Performance

The Windows Indexing Service provides you with the ability to... Read More

Great Plains Bill of Materials Setup & Customization for Process Manufacturing ? Overview

Microsoft Great Plains has full-featured Manufacturing suite of modules: Capacity... Read More

IBM Lotus Domino or Microsoft Exchange?

IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More

eStore Advantage ? Extending Microsoft eConnect for MBS Great Plains

eStore Advantage allows front-office applications to communicate with back-office business... Read More

Microsoft CRM Integration With Microsoft Office Documents ? Overview For System Integrator

Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More