crazyweblist.com crazyweblist.com
   Main About Us Privacy of Info Terms of Use Add Url Add Article
Search:   
 
 

Auto Responder Value

Your auto responder is 24 hours 7 days a week staff that will increase your sales. - Carolyn Bell Smith
 

Make a Connection with Your Ezine Readers

Learn to make a connection with your ezine readers and they will become your raving fans. This artic ... - Alicia Forest
 

Great Content Ahead! But You Have to Register First

I found a great article and forwarded it to a colleague who might benefit from it. The colleague ema ... - Meryl K. Evans
 
 

One Powerful Marketing Strategy

In each marketing promotion or launch, you need to have a powerful marketing strategy to make it suc ... - Patric Chan
 

Five Golden Rules For Dealing With Spam

Spam is a nightmare these days for anyone running a home based business or just having a plain ordin ... - Mike Morris
 
 

Main » 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 eminent columnist. Boris likes to write articles about this subject.
You can also reach this article by using: free software, free software downloads, cheap computer software, discount software
 
 
 

Related Articles

 
Forums Drive Traffic To Your New Website
 
5 Things To Consider When Publishing A Newsletter
 
Selling Niche - The Way Forward in eBay eBook Selling
 
Looking For An Affiliate Internet Marketing Tip?
 
The Sure Fire Way To Make Money With A Personal Computer
 
DiscoverThe Deepest Secrets For Choosing The Potential Affiliate Programs...
 
In Response to the Next Sea Change from Bill Gates
 
What''s the Difference Between the Big 2 Affiliate Networks?
 
Style up your work with the all new Samsung D500
 
PCI-Express vs AGP: Which to Choose?
 
 
 
 

Self Enhancement

 

Medicine & Treatment

 

Science & Research

 

Teens & Children

 

Fitness & Health

 

Tour & Travel

 

Companies & Business

 

Outdoor & Sports

 

Jobs & Employment

 

Automobile & Automotive

 

Property & Estate

 

Music & Entertainment

 

People & Communities

 

Culture & Art

 

Lifestyle & Fashion

 

Internet & Computers

 

Policies & Law

 

Events & News

 

Home & Garden

 

Games & Play

 

Education & Reference

 

Shopping Online

 

Food & Recipe

 

Finance & Investment

 
Main Privacy of Info Terms of Use  
© 2006 www.crazyweblist.com - All Rights Reserved