1. Jon Stoller
  2. PowerBuilder
  3. Tuesday, 26 June 2018 07:07 PM UTC

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


Responses (2)
  1. Likes
  2. Latest
  3. Oldest
Loading...

Find Questions by Tag

.EXE .NET 6.0 .NET Assembly .NET Core 3.1 .NET Core Framework .NET DataStore .NET Std Framework 32-bit 64-bit ADO.NET AEM AI Algorithm Amazon AWS Android Apache API APK App Store App Store (Apple) Appeon Workspace Appeon Xcelerator Plug-in Architecture Array ASE Asynchronous Methods Authentication AutoBuild AutoCompiler Automated Testing Automation AutoScript Azure Barcode Base64 Batch BigData BLOB Branch & Merge Browser Bug Build Button C# C# Class Importer C# Editor C# Model generator Calendar Camera Certificate Chrome Citrix Class Client Client/Server Cloud Cluster Collection COM Command Line Compiler Compression Computed Field Configuration Controls Cookies Cordova Crash Cross-Platform Crosstab CSharpAssembly CSharpObject CSS CSV Cursor Data Database Database Driver Database Painter Database Profile Database Provider DataObject DataSource DataStore DataStore (C#) DataStore (PS) DataType DataWindow DATE DATETIME DB2 Debug Debugger Debugging Deployment Design DLL DO-WHILE Dockable Docker Documentation DOUBLE Download DragDrop Edge Edit Style Editor Elevate Conference Email Embedded SQL Emulator Encoding Encryption Enhancement Request Entity Entity Framework ERP Error Event Event Handler Event Handling Excel Exception Export Expression External Functions F# Field File File Access Filter Firefox Firewall Font FOR-NEXT Foreground Format Function Garbage Collection GeoLocation Git Graph HANA Hash Header HTML/5 HTTP/S HTTPClient Icon IDE Identity IIS IMAPI Import InfoMaker Inheritance Installation Integer IntelliSense Interface Internet Internet Explorer iOS IPA iPad iPhone IWA J# Java JavaScript JBoss JDBC JOIN JSON JSONGenerator JSONParser Kestrel Label Lambda Large File LDAP Library License LINQ Linux OS Load Balancing Localization Localized PBVM Log In Log Out Logging LONG LONGLONG macOS MAPI Maps MDI Memory Memory Leak Menu Merge MessageBox Messagging Method Migration MIME TYPE Mobile Model ModelStore ModelStore (C#) MSOLEDBSQL Multi Threading MVC MySQL n-Tier Namespace NativePDF NVO OAuth ODATA ODBC Office Offline OLE OLEDB Online Open Source OpenAPI OpenSSL Oracle OrcaScript Other Outlook Output Package Parameter Patch PayPal PB Classic PB Native PB.NET PBC PBD PBDOM PBG PBJVM PBL PBNI PBORCA PBVM PBX PDF Performance Permission PFC Picture Pipeline Play Store (Google) Plugin Popup Port POST PostgreSQL PowerBuilder PowerBuilder (Appeon) PowerBuilder (SAP) PowerBuilder Compiler PowerBuilder Runtime PowerClient PowerScript (PS) PowerScript IDE PowerScript Migrator PowerServer PowerServer Mobile PowerServer Toolkit PowerServer Web PowerServerLabel Print Properties Proxy Publish PULL PUSH Query Regression Release Renew Resize Response REST Retrieve RibbonBar RibbonBar Builder Rich Text Roadmap RPC Runtime Packager SaaS Scaffolding Script SDI SDK Security Server Service Session Single Sign-on Size SMTP SMTPClient SnapDevelop SOAP Sort Source Code Speech Recognition SQL SQL Anywhere SQL Server SqlBuilder SqlExecutor SQLite SqlModelMapper Storage Stored Procedure Subscription SVN Swagger Syntax TabbedBar TabbedView Tablet TabPage Target TE Control Testing Text TFS Theme TIME Timer TLS/SSL Tomcat TortoiseGit TortoiseSVN Transaction Transparency Trial Trigger TRY-CATCH TX Control Type UI ULONG UltraLite Uninstall Unit Test Unit Testing UNIX OS Update Upgrade Upload URL User Center User Object UWP Validation VARCHAR Variable Versioning Visual Studio Visual Studio Code VM Voice Warning WCF Web API Web Extensions Web Service WebBrowser WebForms WebLogic WebSphere WildFly WinAPI Window Windows OS WinForms Wizard Workgroup Workspace WPF XCODE XHTML XML Zoom

Helpful?

If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.