Convert from IMailItem to IPostItem...

  • Thread starter Thread starter vinkal.chudgar
  • Start date Start date
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
 
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
 
Back
Top