views:

402

answers:

1

I want to get email title in PockerOutlook in Windows Mobile, but currently Microsoft.WindowsMobile.PocketOutlook has the ability to:

  • Enumerate messaging accounts.

  • Send Email

  • Send SMS

  • Intercept SMS

So I want to DLLImport MAPI.DLL to get its functions in order to get the title of email.

I find this reference written in C++. It seems to be difficult to convert to C# version due to different data type. Should I create a dll file by myself written in C++ and DLLImport to C# app?

A: 

I'm not a C# person, but MAPI is a COM based system. So you don't want to import the MAPI dll, you want to use whatever C# system has for warpping COM interfaces (COM Interop).

You enumlate the messaing stores with ICEMAPISession then you enumlate the folders in each store (or go directly to known folders like the "inbox") with IMsgStore. Then you can emulate the messages in the folder with IMAPIFolder.

Once you get the email message entry (IMessage) you ask for the PR_SUBJECT property.

You have to get used to the COM Interop in C# and the somewhat confusing MAPI interface.

Shane Powell