How can I pop up a "New Email" window in Microsoft Outlook from PowerBuilder.
I am able to "Send" an email from PowerBuilder via Microsoft Outlook. I can tell it the email address to send it to, enter the Subject, Text for the body, enter a CC, and attach a file.
PowerBuilder does send the email.
However, instead of sending it, I need to pop up the New Email instead of sending it.
NOTE: Assume Outlook will be running and open for the user
How can I do this so the user sees the email before it is sent, ande let the user click on "Send" to send it..
The above items - subject, cc's, attachment, etc., should be in the new email when it pops up.
I tried using the code that sends the email - see below - except I changed the "ole.item.Send" statement.
However, I couldn't get it to create the email and put me in the Outlook window.
Here is a screen sample of what I want the code to do. I would like it to pop up an outlook window like this:
The text below is a snapshot of the code I used it to send the email.
To put the user into Outlook, is it a matter of just changing the "ole_item.send" instruction, or do I need to do something else?
(NOTE - I took out most of the code to handle errors and bad return codes):
String ls_folderfile, ls_email_addr, ls_subject, ls_email_text_message, ls_sender_addr
integer li_return, li_result
OLEObject ole_item, ole_attach, ole_outlook
ole_outlook = Create OLEObject
li_result = ole_outlook.ConnectToNewObject("outlook.application")
if li_result <> 0 then
Messagebox("Outlook Error","......")
destroy ole_outlook
li_return = -1
else
ole_item = ole_outlook.CreateItem(0)
ole_item.SentOnBehalfOfName = ls_sender_addr
ole_item.To = ls_email_addr
ole_item.Cc = 'cc@madeup.domain.com'
ole_item.Subject = ls_subject
ole_item.Body = ls_email_text_message + char(13)
ole_attach = ole_item.Attachments
ole_attach.Add(ls_folderfile)
ole_item.Send //Sends Email - How can I pop up the new email instead of Sending it ?
end if
ole_outlook.DisconnectObject()
destroy ole_outlook
Thank you ahead of time for any help.
Jon Stoller
AKA Software