darkgrey.com darkgrey.com
  Index >> About Us >> Add Your Link >> Privacy Policy >> ToS >> Submit Article
Search:   
Add Url
 

Banking & Finance

Automobile & Automotive

Art & Culture

Shopping Online

Property & Agents

Medicine & Treatment

Employment & Careers

Self Help

Cooking & Drinking

People & Communities

Internet & Computers

Fitness & Health

Science & Space

Events & News

Garden & Home

Teens & Kids

Education & Reference

Games & Play

Sports & Adventure

Companies & Business

Fashion & Lifestyle

Travel & Vacation

Music & Entertainment

Law & Politics

 

Index » Internet & Computers » Paid Software
 

Removing Incoming Email in MS Exchange, C# Example

 
Author: Boris Makushkin

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 + "\n" + 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 users 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 + "\n" + ex.StackTrace);

} }

Happy customizing! Boris Makushkin

Author Bio:
Boris Makushkin is a famous writer. Boris likes to scribble articles about this topic.
You can search for this article using: Removing Incoming Email in MS Exchange, C# Example, Internet & Computers, Paid Software, web desig
 
 
 

Related Articles

 
What Exactly Are Google AdWords?
 
The 10 Commandments of Guerrilla Marketing Design
 
Is 'Complex Equivalence' Hindering Your Online Success?
 
Navigate More Website Activity Through Email Newsletters To Visitors
 
Affiliate Marketing Case Studies: How To Find Them
 
Professional Web Design
 
Creating a Sitemap
 
How to Keep Robots Out of Your Web Site
 
How To Create A Homepage That Works
 
Follow Up Or Fail
 
 
 
 

Viral Systems & Technologies - What Are They?

What is a viral system? Simple. Any system that propagates itself simply because using it creates a ... - Ted Gross
 

Cybersquatting and the Affiliate

How to keep the traffic to your affiliate site away from the competition. - Karen Kari
 

Blog On Business Market Basics - Learn Market Strategies That Will Produce Results

Learn a proven system that will help you earn money. Learn techniques for earning money from more th ... - Michele McRae
 
 

Start Internet Business - Learn How Easy It Is

If you want to start an Internet business, the best place to start is of course the Internet. You ca ... - Peter Alderton
 

The Best Internet Advertising is Free Internet Advertising

Free internet advertising is one very important method for promoting your products and services to t ... - Nicky Pilkington
 

How to Make Your Own Affiliate Site

A quick guide to creating a website using affiliate links to generate extra money. - Mike Hensley
 

Why You Need Submit Articles To E-zines

Ezine publishes have large amount of loyal subscribers. If you send articles to ezine publishes, rea ... - Julia Tang
 

A Guide To Purchasing Your Next Personal Computer

With the frequent advances in personal computing you may find yourself updating your pc sometime soo ... - T Potter
 
 
Index >> Privacy Policy >> ToS  
© www.darkgreycells.com - All Rights Reserved Worldwide