Convert from IMailItem to IPostItem...

V

vinkal.chudgar

HI,

I have created a COM Addin in VC++/ATL.

I am using Outlook 2003.

when user press send button,OnSendMail function gets called.

OnSendMail function look like

OnSendMail(IDispatch* Ctrl,VARIANT_BOOL * CancelDefault)
{
CComQIPtr < Outlook::_MailItem > spMail(Ctrl); // works

CComQIPtr < Outlook::_PostItem > post(Ctrl); // not works



}

I would like to have PostItem Pointer but Outlook addin gives MailItem
Pointer.

I have also tried to convert mailItem Pointer to PostItem but it does
not work.

I want to have PostItem Pointer because i want to save mail in sent
state and MailItem Pointer does not provide this as SentOn Property is
readonly.



Is there any way to achieve it ?

regards,

vinkal
 
D

Dmitry Streblechenko

Post items are never sent, they are posted. If you want the message in the
sent state, trap the MAPIFolder.Items.ItemAdd event (where MAPIFolder points
to the Sent Items folder). By that time the item is in the sent state and
its sender related properties are set.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

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