E-mail from InfoPath - InfoPath Dev
in

InfoPath Dev

E-mail from InfoPath

Last post 10-15-2010 12:28 PM by Potemkine. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-05-2010 06:49 AM

    E-mail from InfoPath

    I wonder if someone here can help me.

     I have a wonderfully working Infopath form until I upgraded my Office to 2010.

    Essentially I've created buttons that send e-mails out. Here is an example of the code:

     ' Create a new MailItem.

    Dim oMsg As Outlook._MailItem

    oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)

    oMsg.Subject = "subject here"

    oMsg.Body = "text here"

    oMsg.To = [email protected]

    Dim sBodyLen As String = oMsg.Body.Length

    ' Send

    oMsg.Send()

    ' Clean up

    oApp = Nothing

    oMsg = Nothing

    In order to get this working I had to add "Imports Outlook = Microsoft.Office.Interop.Outlook" to the top of the form and add a reference to this in Project explorer.

     

    However when I went to 2010 it broke, I had to add this reference again. Now users are reporting the form does not work with Outlook 2007.

     Does anyone know how to fix it so it works on both?

     Thanks,

     Nick

  • 10-05-2010 01:17 PM In reply to

    Hi Nick,

    Why are you writing code to do this? Just use the e-mail data connector. No code means less maintenance cost. Nothing in your code is special. You can do it all with out-of-box rules and data connections from the InfoPath Designer.

    Patrick Halstead
    Project Manager at Qdabra
  • 10-15-2010 11:35 AM In reply to

    The problem is the data connector did not allow me to customize the e-mails in the way i need. I couldn't change the body of the e-mail message to just sections i wanted. Unless I missed something.

     

    I also need lots of buttons that e-mail off to different people in some cases, and only e-mail sections of the form. This formatting of the e-mail is extremely important, hence why i did it as above.

     Anyone know how to get my code to work in Infopath 2007 and Infopath 2010?

  • 10-15-2010 12:28 PM In reply to

    Hi,

    What is the version of Microsoft.Office.Interop.Outlook you add ? I guess it's 14.0.0.0

    Try to add the 12.0.0.0 instead of the 14.0.0.0 and try it on both environment.

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