tags:

views:

1746

answers:

5

I'm doing background work for an Exchange Server Mail Archiver. I'm planning to do it using C#. Can anyone give some idea how to start off. Can I get a sample application which illustrates how MAPI can be used to read mails from exchange server. Since MAPI is a Cpp dll, can I get a C# wrapper for the same.

+2  A: 

Using MAPI from managed code is not supported and should be avoided. If you're starting from scratch, I'd look at EWS (Exchange Web Services) and design your product to support Exchange 2007 and Exchange 2010.

Cain T S Random
+1  A: 

You really don't want to use the MAPI C# wrapper. It will be okay in testing, but as .NET and the MAPI dll manage their own memory occasionally (read 300 users, many times an hour) they will overwrite each others memory pools.

In the end we ended up writing a VB6 app that took in a file argument with what we wanted to send, and then wrote a file in c# and called the vb6 app. This works as they are separate processes and thus don't overwrite each others memory pools.

My advice to you is to not go down the mapi route (unless you enjoy pain), and if possible use EWS (we cannot do this due to the company not wanting to upgrade).

Pondidum
+2  A: 

If you really need to go the Extended MAPI route (like we had to in my previous job) i would first advise you to do it in plain C++ and do your own custom wrapper for what you need. You do not want to interface directly with MAPI in managed code

I would also suggest reading http://blogs.msdn.com/stephen_griffin/ He is basically the MAPI guru at MS.

Good luck if you go there

MLefrancois
A: 

It’s correct that using a C# wrapper would be nearly impossible, but writing a wrapper in C++.NET is very doable. We have written our own MAPI wrapper in C++.NET and utilized from C#. It’s working great

Thomas, ComArchive

+1  A: 

I realize it has been a couple months since you've posted this, but for posterity - try this: Redemption

Eric Dahlvang