C # how to read message store on Windows 6 mobile device
can anyone post an example of how to read messagestore on a windows 6 mobile device? I did it 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 an evaluation version of InTheHand. I would like to do this using OpenNetCF or mapidotnet if possible. But I didn't figure out how to do this with OpenNetCF and mapitdotnet is no longer available on the sourceforge site ( http://sourceforge.net/projects/mapidotnet/ ). I only found it in the svn directory, but no DLL.
a source to share
None of the OpenNETCF libraries provide this functionality. We didnโt try to implement it, because there is already a solution available (InTheHand library) and I donโt like to reinvent the wheel if thereโs an excellent one already available .
If the price is too steep for you, you can always see the MSDN article on COM Interop in the CF , and couple that with some of the online tutorials on MAPI and MAPI documentation .
The MAPIDotNet project is probably worth exploring too . You say there are no binaries, but what does that mean? You have a compiler.
MAPI is messy and confusing, even in C ++. From experience I can tell you that it all works in C # (I did it 1.0 days before InTheHand got my product) takes at least a week and if you know how to work with COM and C ++ ...
a source to share
Ok I figured out how to do it using 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 did compile the project, but I had a strange error that I could not add Mapilib.dll to my project. But now I am working.
a source to share