A
Antonio Casilias
Hi.
That's my code:
//-------------------------------------------------------
Outlook::_ExplorerPtr ouExp = spApp->ActiveExplorer();
Outlook::SelectionPtr ouSel;
ouExp->get_Selection(&ouSel);
long lCount;
ouSel->get_Count(&lCount);
// I need to run next part only for email messages not for contacts or tasks
in Outlook
for (long l = 1; l <= lCount; l++)
{
IDispatchPtr olDisp = ouSel->Item(_variant_t(l));
Outlook::_MailItemPtr olMail(olDisp);
IUnknownPtr olMsgUnk;
olMail->get_MAPIOBJECT(&olMsgUnk);
CComPtr<IMessage> olMapiMessage;
olMsgUnk->QueryInterface(IID_IMessage,
reinterpret_cast<void**>(&olMapiMessage));
// doing something with message
// removing MailItem
}
This is part of button click event hadler. It removes email messages. But if
I select in explorer one of contacts of tasks - it removes them too. How to
avoid this?
Thanks.
That's my code:
//-------------------------------------------------------
Outlook::_ExplorerPtr ouExp = spApp->ActiveExplorer();
Outlook::SelectionPtr ouSel;
ouExp->get_Selection(&ouSel);
long lCount;
ouSel->get_Count(&lCount);
// I need to run next part only for email messages not for contacts or tasks
in Outlook
for (long l = 1; l <= lCount; l++)
{
IDispatchPtr olDisp = ouSel->Item(_variant_t(l));
Outlook::_MailItemPtr olMail(olDisp);
IUnknownPtr olMsgUnk;
olMail->get_MAPIOBJECT(&olMsgUnk);
CComPtr<IMessage> olMapiMessage;
olMsgUnk->QueryInterface(IID_IMessage,
reinterpret_cast<void**>(&olMapiMessage));
// doing something with message
// removing MailItem
}
This is part of button click event hadler. It removes email messages. But if
I select in explorer one of contacts of tasks - it removes them too. How to
avoid this?
Thanks.