Software Information |
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/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: Unable to open RSS Feed $XMLfilename with error HTTP ERROR: 404, exiting |
RELATED ARTICLES
Microsoft Great Plains RW: Report Writer Microsoft Business Solutions Great Plains is marketed for mid-size companies as well as Navision (which has very good positions in Europe and emerging markets where it can be easily localized). Great Plains Report Writer (RW) module allows for modification and creation of Great Plains reports to suit your business needs. Computer Based Language Development and Spell-checking Language development computer:Computer-based method for aiding language development seems like an interesting idea, the trick with this would be in getting the computer to take on part of the role of the human in the checking process.In all computer aided learning applications aimed at the very young, there is a danger that the computer may be seen as a replacement for a human instructor, however computer are notorious for not volunteering information or inability to deal with erratic behaviour. Data Quality Best Practices for Salesforce.com Executive SummaryAn effective plan for entering, cleaning and updating the data for your salesforce.com (SFDC) system is critical for achieving success with SFDC. Microsoft Great Plains Security Setup - Overview For Consultant Microsoft Business Solutions Great Plains is very good fit for mid-size company and probably good budget solutions for large corporation. Former product name was Great Plains Dynamics / eEnterprise. Microsoft Great Plains e-Commerce - additional considerations for programmer Microsoft Great Plains, designed back in 1990th as database transferable and graphical platform independent ERP application - Great Plains Dynamics/Dynamics C/S+/eEnterprise. For eCommerce developer the most important is to understand Great Plains tables structure and business processes in Sales Order Processing, Accounts Receivables, Inventory Control (inventory items allocation, backordering, etc), posting to Bank Reconciliation and General Ledger. 3 Reasons Why Medical Billing Software is Leading the Way Since technology changes so quickly, it is hard to begin by saying "in the old days . . Easy Guide to RAID Recovery What is RAID RECOVERY?RAID stands for Redundant Array of Inexpensive Disks. It is a method of combining several hard drives into one unit. Windows Screensavers Explained In this article you will find some background information about screensavers and their history. You will also learn how Windows screensavers differ from other programs and how you can use it to your own advantage. The Truth: Netzero 3G We've all seen the ads on TV for Netzero 3G. You know the ones, "speeds so fast you sworn it was broadband" Well if your using it, you may not think it really is. Adware and Spyware Blockers The most important things you can do for your computer right now is to install adware and spyware blockers. Everyone is aware of computer viruses and run an anti-virus program to guard your computer against them. 10 Things You Could be Using Photoshop For, But Probably Arent Most people don't use Photoshop to its fullest capabilities. Here are just ten uses to which you could put this highly versatile software. CRM 101: Customer Relationship Management for Beginners Customer Relationship Management, abbreviated "CRM," is the term for a business strategy that is designed to improve customer service. CRM is also designed to increase customer satisfaction and gain new customers, thus increasing a business' revenue. Groupware: What Works the Way Businesses Do? GroupwareThe internet is full of 1.5 million to 7 million indexed pages of groupware packages available on the market today. Putting Screensavers Under Control No matter how much you enjoy your favorite screensavers, sometimes they can be rather annoying. Don't like them interrupting your presentations? Hate them disturbing you watching movies? Look no further. Free Program Removes Spyware not Detected by Premium Security Scan What is Spyware?Spyware monitors your surfing habits and sends the data off to some remote server in cyberland. Your computer can get infected with spyware easily by visiting a web page or installing a software program. How to Make Own CMS Every day millions of new web documents emerge on the Internet, and the amount of web management tools is growing simultaneously. These tools are usually referred to as Content Management Systems, CMS for short. Linux vs Windows Operating Systems With so many Microsoft Windows related viruses, errors, and other software problems, many average computer users are looking at alternative operating system platforms, such as Linux. It is important that users, frustrated with Windows, don't simply install a version of Llinux without knowing what they are in for. Microsoft Great Plains Implementation & Customization: Computer Parts Retailer Example Microsoft Great Plains fits to majority of horizontals and retail business is good fit as well. We'll consider the system, consisting from Microsoft Great Plains as Accounting, Inventory Pricing and Microsoft Retail Management System (RMS) Headquarters and Store Operations Manager. SQL Administrator Skills Required to Support Microsoft Great Plains Microsoft Great Plains is becoming more and more popular and we see new purchases among midsize and large corporations, where, in our opinion, Microsoft SQL Server DB administrator position is a must. If you are database administrator and you are part of the decision making team, purchasing Microsoft Business Solutions Great Plains for your corporation, we would like to set your expectation on the level of SQL knowledge, skills and experience needed to support Microsoft Great Plains in-house? Data querying. Microsoft Great Plains Integration Manager - Working With Text File Microsoft Business Solutions main middle market ERP application - Microsoft Great Plains has multiple integration options: MS SQL Scripting (stored procedures and views), ADO.Net programming, Microsoft SQL Server DTS packages. |
home | site map | contact us |