Open Outlook / Submit Button - InfoPath Dev
in

InfoPath Dev

Open Outlook / Submit Button

Last post 08-22-2011 01:19 AM by jimblue1. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-22-2010 12:44 PM

    Open Outlook / Submit Button

    Is there a way on the submit button to open our outlook so you can edit the email before it is sent?

     

    Thanks in advance.

     

     

  • 03-22-2010 10:53 PM In reply to

    Re: Open Outlook / Submit Button

    i dont think there is a way to do so, but i would also like to know if there is any way to do so

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 03-23-2010 06:40 AM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: Open Outlook / Submit Button

    Hi

    Using IP2003 I have added a button with a rule set to 'submit to data connection'. For the same button I have added the following code (VBScript).

    Sub Submit_OnClick(eventObj)

    Dim myEnvelope

    set myEnvelope = Application.ActiveWindow.MailEnvelope

    ' Specify addresses, subject, and introduction.

    myEnvelope.To = "email address"

    myEnvelope.CC = "email address"

    myEnvelope.BCC = "email address"

    myEnvelope.Subject = "Plot request"

    myEnvelope.Introduction = "Type text here"

    ' Include form template with form.

    myEnvelope.EmailAttachmentType = EmailAttachmentType.XmlXs

    ' Display form with e-mail envelope.

    myEnvelope.Visible = True

    End Sub

    This opens Outlook with a preview of the email which you can edit or add additional instructions. There will also be a JScript equivalent of the code.

    Gary

  • 08-22-2011 01:19 AM In reply to

    Re: Open Outlook / Submit Button

    I've used the C# code below on InfoPath 2010 and it works on on the rich-client. It doesn't work on IPFS.

     using Outlook = Microsoft.Office.Interop.Outlook;

     public void btnOpenOutlook_Clicked(object sender, ClickedEventArgs e)
     {
     
                Outlook.Application oApplication = new Outlook.Application();
                Outlook.MailItem newMail = (Outlook.MailItem)oApplication.CreateItem(Outlook.OlItemType.olMailItem);
               
                newMail.To = "[email protected]";
                newMail.Subject = "test email from infopath";
                newMail.Body = "hello world";

                newMail.Display(false);

    }

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.