Creating new message in Windows Mail

5 views
Skip to first unread message

jmckay321

unread,
Sep 14, 2009, 1:15:57 PM9/14/09
to Nektra OEAPI Support
I have been using the OEAPI since Outlook Express and moved it to
Windows Mail. Based on your sample code,
my code to add a new message to a folder is basically:

CreateMessage();
Commit();
Clone();
Commit(); // the cloned message
Delete(); // the original message

I really have no idea why I am going to the trouble of cloning the
original message then deleting the original, but
apparently that was necessary for some reason at some point.

Now I have a customer who reports that my application is creating
duplicate messages in Windows Mail. Upon investigating, it turns out
that the Delete() call is failing, thus the duplicate message. When
I tried changing the code so that we just do the CreateMessage(), and
skip the clone/delete, it still works fine.

So my questions are, why was the original logic necessary, and can it
be gotten rid of at this point? And any idea why the Delete() call
may have failed on my customer's machine? It still works on several
systems I tested here, including Vista, XP, Outlook Express and
Windows Mail.

Nektra OEAPI Support

unread,
Sep 14, 2009, 4:37:54 PM9/14/09
to nektra...@googlegroups.com
Hi Jeff,

For the first question, cloning might be helpful for certain cases, two
examples are:
1) It worked for some messages with special characters that got
corrupted when modified directly.
2) When you already have a message in a folder, the fields displayed in
the messages listview, like the From and the Subject, are obtained from
the stored message only the first time, and are stored on an internal
quick-access table for the listview. If you modify one of this fields on
a message directly, this change is not reflected on the listview, just
on the detail view (preview pane or opened message window). Modified
clones are reflected correctly.

By the way, calling Commit to the message obtained by the CreateMessage
method was never needed (I refer to the first Commit on the sequence you
wrote).

Now I've got some questions for you too:

1) OEAPI Edition and Version number.
2) Programming language and development software version used.
3) Is it a DLL or an EXE plugin?
4) Has the Vista used by your customer UAC (User account control)
enabled or disabled?
5) Is the Delete method called directly from the original message (I.E.
OEMessage::Delete)? Or is OEFolder::DeleteMessage called?

Some ideas about the Delete failing are that UAC enabled might
interfere, and also currently selected messages get locked by Windows
Mail and fail to be modified/deleted directly (in this case calling
OEAPIObj::SetSelectedMessageID(-1) is useful to deselect messages).

Thank you for contacting Nektra's OEAPI Support.

Regards,

Federico
--
Nektra Advanced Computing
http://www.nektra.com

Reply all
Reply to author
Forward
0 new messages