Outlook express problem

Tags:
Microsoft Exchange
hello, The following code is used to show outlook express send mail dialog box. But i am unable to attach a file from vc++ program. can someone tell me how to do this? code is------------> _NameSpacePtr pNameSpace; MAPIFolderPtr pOutbox; _ItemsPtr pOutboxItems; _MailItemPtr pNewMail; CComPtr<Attachments> pAtach; RecipientsPtr pRecipients; RecipientPtr pRecipient; HRESULT hr = NULL; _ApplicationPtr m_pApp("Outlook.Application"); CComPtr <_Inspectors> pInspectors; m_pApp->get_Inspectors(&pInspectors); m_pApp->get_Session(&pNameSpace); pNameSpace->GetDefaultFolder(olFolderInbox,&pOutbox); pOutbox->get_Items(&pOutboxItems); VARIANT Type; m_pApp->CreateItem(olMailItem,(IDispatch**)&pNewMail); CComPtr <_Inspector> pInspector; hr = pInspectors->Add(pNewMail, &pInspector); if(FAILED(hr)) return ; hr = pInspector->Activate(); if(FAILED(hr)) return ; hr = pInspector->Display(); if(FAILED(hr)) return ; by this code dialog box will appear but i want to attach a file before showing dialog.

Answer Wiki

Thanks. We'll let you know when a new response is added.

The method to use is MailItem.AttachmentAdd. I can’t give you C++ code sample as I’m not that well versed in it, but I’m sure you can look up the syntax somewhere.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: