Unexpected behavior of e-mails in Junk folder

Joined
Jun 2, 2009
Messages
4
Reaction score
0
Hi,

I am writing an C++ COM add-in and I have a question about unexpected behavior of e-mails in Junk folder.

My addin checks certain specific properties of an e-mail and perform actions based on these properties. This works well except case when the e-mail is stored in the folder "Junk E-Mail". The following unexpected behavior occur:
a) Select e-mail in "Junk E-Mail" folder. In preview window is written something like this: "move e-mail to Inbox folder to unlock it".
b) In response to OnSelectionChange event of Outllook::Explorer my addin check state of selected e-mail (and nothing to do in this case).
c) I move e-mail to "Inbox" folder but state (and text in preview window) has not changed.
d) Only after re-start Outlook I have an ordinary e-mail.

If my addin is disabled then behaviour of e-mail in "Junk E-Mail" folder becomes correct i.e. move to "Inbox" -> ordinary e-mail. It is obvious that this is a problem of my plugin. But I do not understand why.

Attempts to determine cause of this problem led to following results. When I try to access to some fields of Outlook::MailItem object - this e-mail remains locked until Outlook is restarted.

Example of code to reproduce:

void CheckSelectedItem(IDispatch *item)
{
CComQIPtr<Outlook::_MailItem> mailItem(item);
if (mailItem)
{
IUnknown *mapiObject;
HRESULT hr = mailItem->get_MAPIOBJECT(&mapiObject);
if (SUCCEEDED(hr) && mapiObject)
{
/* Nothing to do. */
/* I disable all code to find cause of problem. */
mapiObject->Release();
}
}
}

If I comment out call of mailItem->get_MAPIOBJECT() then problem is not reproduced.
There are any ideas? Please help!

PS: WinXP SP3, Outlook 2007.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top