Software informational articles

Removing incoming email in ms exchange, c# case in point - software

 

The aim of one of our projects was MS Chat handler for giving out incoming email.

The basic basis of awareness was this critique "Developing Managed Event Sinks/Hooks for Argument Ma?tre d'h?tel Store using C#" by Logu Krishnan, in print to the deal with http://www. codeproject. com/csharp/CsManagedEventSinksHooks. asp, and also examples from Microsoft Chat SDK.

We utilized Synchronous Measures and produced the handler, which fires on OnSyncSave event. The handler creates doings album in Microsoft CRM and then removes the idea in the Barter folder beforehand the commitment:

public void OnSyncSave(IExStoreEventInfo pEventInfo, cord 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 Chat handlers debugging - it is the exceptionally handy to use coordination log4net in RollingLogFileAppender or RemoteAppender modes (for numerous demand of COM + objects). You can read more on this branch of learning here http://logging. apache. org/log4net/ To allow the handler incoming mail removal, it is de rigueur to give apt human rights to the user, under which bank account the COM+ appliance runs the handler. These are human rights on alter of the in order in user's boxes for whom it is registered (Windows 2003 Server: Energetic Encyclopedia Users and Central processing unit -> Users -> Properties (for COM+ concentration account) -> Altercation Complex -> 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 Coax in Alba Spectrum Technologies - USA countrywide 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 manifold states and globally (www. albaspectrum. com), he is Dexterity, SQL, VB/C#. Net, Rock Gossip and Microsoft CRM SDK developer.


MORE RESOURCES:
Developed by:
home | site map
goldenarticles.net © 2018