views:

131

answers:

2

Hi,

can anyone post an example how to read the messagestore on a windows mobile device 6? I done this with "InTheHand":

foreach (InTheHand.WindowsMobile.PocketOutlook.SmsMessage mess in sess.SmsAccount.SentItems)
                {
                    if (mess.Received.Year == thisYear && mess.Received.Month == thisMonth)
                    {
                        smsThisMonth++;
                    }
                }

The problem is, that I only have a evaluation version of InTheHand. I would like to do this with OpenNetCF or mapidotnet, if possible. But I didn't figure out how to do this with OpenNetCF and mapitdotnet isn't available anymore on the sourceforge site (http://sourceforge.net/projects/mapidotnet/). I only found it on the svn directory, but there are no dlls.

+1  A: 

None of the OpenNETCF libraries provide this functionality. We didn't bother trying to implement it because there already is an available solution (InTheHand's library) and I don't like reinventing the wheel if there's a perfectly good one already available.

If their price is too steep for you, you can always look at this MSDN article on COM Interop in the CF and couple that with some of the online tutorials on MAPI and the MAPI documentation.

The MAPIDotNet project is probably worth investigation too. You say there are no binaries, but what does that matter? You have a compiler.

MAPI is convoluted and confusing, even in C++. From experience I can tell you that getting it all working in C# (I did it back in the 1.0 days before InTheHand had their product) takes at least a week and that's if you know how to work with COM and C++.

ctacke
+1  A: 

Ok, I figured out, how to do this with mapidotnet:

MAPI mapi = new MAPI();
IMAPIMsgStore[] stores = mapi.MessageStores;

        for (int i = 0; i < stores.Length; i++)
        {
            if (stores[i].DisplayName == @"SMS")
            {
                IMAPIFolder smsSentFolder = stores[i].SentMailFolder.OpenFolder();
                smsSentFolder.SortMessagesByDeliveryTime(TableSortOrder.TABLE_SORT_DESCEND);
                IMAPIMessage[] messages = smsSentFolder.GetNextMessages(999);
                for (int n = 0; n < messages.Length; n++)
                {
                    if (messages[n].LocalDeliveryTime.Month == monat && messages[n].LocalDeliveryTime.Year == jahr)
                    {
                        smsDiesenMonat++;
                    }
                }
            }

I actually compiled the project, but I had a strange error, that I could not add the Mapilib.dll to my project. But now I get it to work.

druffmuff