Web Site Promotion | About | Contact | Web Design News |
Chicago Animation : Chicago Web Design - Go Back

Removing Incoming Email in MS Exchange, C# Example

 

Search Engine Specialist

search engine expert Free Internet Marketing consultings from ChicagoAnimation.
To use this free service please fill out the form below and we will call you to offer you free tips.

* First Name: * Last Name:
* Email Address: * Phone Number:
Street Address: City:
ZipCode: Your State (2 Letters):
URL (if available): Your Cell Phone #:
Company Name:
How long has your website been live?
What services or packages can we help you with?

How may we help you?
My current budget is. . .



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

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.

 

MORE RESOURCES:

Business Wire (press release)

Elliott Terminates Tender Offer to Acquire Epicor Software Corporation
MarketWatch - 22 hours ago
... LP and Elliott International, LP (collectively, "Elliott" or "we"), a major shareholder of Epicor Software Corporation (the "Company" or "Epicor"), ...
Epicor drops after hedge fund ends hostile bid Forbes
Hedge Fund Elliott Associates Withdraws Offer for Epicor Software Orange County Business Journal
UPDATE 1-Hedge Fund ends offer for Epicor Reuters
RTT News - Barron's Blogs
all 45 news articles


New York Times

The best thing about the 2.2 iPhone software update
CNET News, CA - 15 hours ago
When it some to iPhone software updates, I'm all about the basics. Apple could enable the iPhone to cook my dinner every night, but if it added multimedia ...
First Look: Apple's iPhone 2.2 Software Hits The Street (And ... CRN
Lots to like about new iPhone 2.2 software update Ars Technica
Apple releases iPhone Software v2.2 Apple Insider
G4 TV - infoSync World
all 132 news articles


BBC News

Microsoft to offer free security software to attract beginners
eTaiwan News, Taiwan - Nov 21, 2008
19 to stop selling personal computer security software and to use free personal anti-virus software instead. The new software called Morro can support seven ...
Microsoft: New software not Symantec, McAfee rival Reuters
Spamhaus: Microsoft Now 5th Most Spam Friendly ISP Washington Post
Microsoft to offer free security software NetworkWorld.com
Wall Street Journal - AHN
all 304 news articles


Traction Software Introduces Live Blog Micro-Messaging and End-of ...
MarketWatch - 19 hours ago
Live Blogs become a standard feature -- not an extra cost option -- for Traction Software's secure, scalable enterprise class hypertext platform which now ...


Vertical Releases Feature-Rich Software Update for Wave
MarketWatch - 10 hours ago
... today announced the release of the Wave 1.5 software upgrade to it's award winning Wave IP 2500(TM) Business Communications Solution, the industry's ...


Check Point Software Announces Participation in Fourth Quarter ...
MarketWatch - 20 hours ago
Check Point Software Technologies Ltd. ( www.checkpoint.com) is the leader in securing the Internet. Check Point offers total security solutions featuring a ...


Hann’s On Software bouht by Mediware
Bizjournals.com, NC - 17 hours ago
Mediware Information Systems Inc. has bought the assets of Hann’s On Software, a pharmacy-management software provider based in Santa Rosa, for $3.5 million ...
Mediware Acquisition Adds 320 Pharmacy Facilities MarketWatch
Mediware Information buys assets of Hann's On Software - Quick Facts RTT News
Mediware Acquisition Adds 320 Pharmacy Facilities International Business Times
all 19 news articles


AVG Sees Uphill Battle for Microsoft in Its Launch of Free Anti ...
MarketWatch - 20 hours ago
AVG, which for eight years has offered free anti-virus software to users worldwide, noted the multiple challenges Microsoft faces in supporting a free ...
AVG sees 'uphill battle' for Microsoft Morro TechRadar UK
Microsoft Announces Upcoming Events for the Financial Community NewsBlaze
Microsoft Announces Upcoming Events for the Financial Community MarketWatch
all 29 news articles


Authoria Appoints New President and CEO
MarketWatch - 15 hours ago
Prior to joining Authoria, Mr. McDevitt was most recently Chief Operating Officer of CDC Software, a $360 million division of CDC Corporation and a global ...


Microsoft’s Mike Neil Keynotes at SYS-CON's 4th International ...
SYS-CON Media, NJ - 9 hours ago
... Black Duck Software, Blackbaud, Blade Network Technologies, Blue Coat, Blue Lane, BlueArc, BlueNote Networks, BluePheonix Solutions, BMC Software, ...
IBM To Acquire Virtualization Specialist Transitive InformationWeek
Teaching Everyone to Speak Big Blue New York Times
IBM To Buy Virtualization-Software Company Transitive NewsFactor Network
eWeek - SearchDataCenter.com
all 95 news articles

Software - Google News

ChicagoAnimation's Acquisitions: Market Polls - 1pennyStock.com
Sponsors: Paving | VTL's | Religious Statues