简体   繁体   中英

How To create a submit button in infoPath to SPoint2013

I have an InfoPath web-based form running on InfoPath Forms Services in SharePoint. I want to be able to submit this form to a SharePoint form library and then use the data in the form to send an email. After submitting the form and sending the email, I want the form to close the InfoPath form programmatically.

1) In InfoPath, design a browser-compatible InfoPath form template

2) On the Data Source task pane, add a Text Field node named formName under the myFields node.

3) On the Tools menu, choose Data Connections. On the Data Connections dialog box, click Add, and create a new Submit data connection As an e-mail message. Fill in any email address in the To field; you will be changing this in code anyway. Accept the default name of Email Submit for the data connection.

4) On the Data Connections dialog box, click Add, and create a new Submit data connection To a document library on a SharePoint site. Fill in a valid URL to a Document Library. Select the formName node from the Main data source to be the File name for the form. Accept the default name of SharePoint Library Submit for the data connection.

5) On the Tools menu, choose Submit Options.

6) On the Submit Options dialog box, select Allow users to submit this form, deselect the Show the Submit menu item and the Submit toolbar button check box, click Advanced and select Close the form from the After submit drop-down list box, select Perform custom action using Code, and click Edit Code.

This will add a FormEvents_Submit event handler to the InfoPath form template.

In Microsoft Visual Studio Tools for Applications, add the following C# code to the FormEvents_Submit event handler:

click here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM