VBA or C# Code for Button Submit to E-Mail - InfoPath Dev
in

InfoPath Dev

VBA or C# Code for Button Submit to E-Mail

Last post 12-26-2011 06:54 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-21-2011 12:38 PM

    VBA or C# Code for Button Submit to E-Mail

    Hi All,

    Product Versions: InfoPath 2010, Visual Basic 2010 Express, SharePoint 2010 (Enterprise Edition)


    I recently published a form on our SharePoint 2010 intranet.  However, I want the Submit action to be sent as e-mail.  To eliminate the recipients pop-up, I found that it would be more efficient to use C# or VBA code for the button click.

     I referred to various forums:

    http://www.infopathdev.com/forums/p/3521/14029.aspx#14029

    I'm looking at the code for C# in that thread, and I don't understand this code: 

    EmailAdapter oEmail = (EmailAdapter)thisXDocument.DataAdapters["EmailConnectionName"];

    The "EmailConnectionName" to be precise.  Does that mean that is the name of the email connection defined in the Submit options for the button? Or is that referencing something else?

     Moreover,  I don't even know if this code will work for what I want to do--which is sending the form as the body in the e-mail.

     Any help would be greatly appreciated.

    Daniel

  • 12-26-2011 06:54 AM In reply to

    Re: VBA or C# Code for Button Submit to E-Mail

    Hi Daniel,

    Assuming you are using the InfoPath rich client, Thierry's code is probably still fine. Note that the object model changed for browser forms between 2007 and 2010 object model.

    To answer your first question, yes, the "EmailConnectionName" is the name of the data connection that you create. It's just a submit data connection. Go to the data connection dialog in the Designer to get the name. Make sure it is spelled correctly with casing correct too.

    I am not sure if tit will send the form in the body of the email or not. You might send Thierry an email.

    Cheers,

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.