Maintain your old Siemens Hipath system

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 http://www.codeproject.com/csh 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 {

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

In The News:

Three dead, 200 injured after Japan earthquake
Mon, 18 Jun 2018 03:46:00 +0100
A nine-year-old girl is among three people to have died following a 6.1 magnitude earthquake in and around the Japanese city of Osaka.

Merkel's leadership under threat over migrant policy
Sun, 17 Jun 2018 16:45:00 +0100
Angela Merkel's leadership is under threat after her alliance partner gave her two weeks to agree to turn away refugees at Germany's borders.

Melania Trump 'hates' scenes at US border
Mon, 18 Jun 2018 02:39:00 +0100
Melania Trump has waded into the row over a controversial White House clampdown on immigration that has seen thousands of children separated from their families at the US border.

Five killed in crash during US Border Patrol chase
Sun, 17 Jun 2018 23:49:00 +0100
At least five people were killed and several others injured after a vehicle carrying 14 people crashed while being chased by US Border Patrol agents in Texas.

Mexico football fans may have caused earthquake
Sun, 17 Jun 2018 20:32:00 +0100
Mexico football fans are believed to have caused a minor earthquake as they celebrated their team's shock win over Germany at the World Cup.



tikatoshop.it

Erfahrungen mit Pallhuber Wein
Agen Bola SBOBET Terpercaya

Travel in comfort and at your leisure with CT Airlink Limousine & Car Service for top quality private transportation and exceptional customer service. We operate Sedans, SUVs & Vans for CT Car Services to covering all Connecticut airports including Car Service from CT to Newark Airport , Mohegan Casino Uncasville CT, Foxwoods Casino Mashantucket CT, Manhattan Cruise Terminal NYC, Brooklyn Cruise Terminal NYC and Bayonne Cruise Terminal NJ. CT Airlink hire licensed and friendly chauffeurs who have in-depth knowledge of the Areas.

Microsoft CRM Data Conversion FAQ

Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More

Increase Office Efficiency With One Simple Tool

When you need a phone number, you do a quick... Read More

C++ Tutorial 2, Input and Variables

This is the tutorial where we really get into programming.... Read More

Vlans

In order to implement VLANs in a network environment, you'll... Read More

Professional Software Icons For Your Standalone Application

User interfaces and accessibility are some of the most important... Read More

Microsoft Great Plains BR: Bank Reconciliation

Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More

Design a Web Album Using Adobe Photoshop- Part 2

So let's begin crunching down these 300 images using Adobe... Read More

Guide to Software Marketing

Intro This concise article will tell you in plain English... Read More

Did You Ever Want to Completely Erase Everything on Your Computer?

Did you ever want to erase everything on your computer?... Read More

Cisco Certification: Introduction To ISDN, Part III

Configuring PPP PAP AuthenticationNow we know how the ISDN link... Read More

Pros and Cons of Using FREE Software in Your Business

Itâ??s easy to understand why you might be drawn to... Read More

Why do Manufacturers Invest in Business Management Software?

With many manufacturing shops heading over seas in favor of... Read More

Kick-Ass Performance For Your PC? Its Easy

Is your PC is slow and wimpy? Then you need... Read More

My Experience - Making a Vision into Reality

Disclaimer: All the thoughts expressed are my views only! Your... Read More

Groupware: What Works the Way Businesses Do?

GroupwareThe internet is full of 1.5 million to 7 million... Read More

Microsoft CRM ? Consulting in the Post-Recession Time

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

Three Steps To Windows Safety Heaven

Now there are Three Steps To Heaven Just listen and... Read More

Programming Language Migration Path

While I was preparing some personal background information for a... Read More

Microsoft Great Plains Project Accounting ? Overview For IT Director/Controller

Microsoft Business Solutions is now in process of creating so... Read More

Upgrading Great Plains Dexterity Customization ? switching to new technologies: SQL, Crystal, eConne

1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More

Microsoft Great Plains Data Conversion ? Overview For Developer

Looks like Microsoft Great Plains becomes more and more popular,... Read More

It?s Back!! WordPerfect?s Amazing Comeback

Have you noticed WordPerfect is gearing up for a comeback... Read More

Microsoft Great Plains: Data Conversion & Migration Scenarios ? Overview for Consultant

Microsoft Business Solutions Great Plains serves multiple industries in the... Read More

Most Common Ways to Accumulate Spyware (where It is Downloaded to Your PC)

It is possible that if one avoided all sources of... Read More

Manufacturing Solutions for Microsoft Great Plains ? Overview for Consultant

Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More