Appendix B. Upload File Attachments in Forms to a Document Library

This appendix presents a code-behind method that uploads an attached file to a separate document library when the form is submitted. The code here was adapted from Pranab Paul’s blog on MSDN.

Form Scenario

The form used in this scenario contains a file attachment control with a field named fileAttach. There is also a button to be used as a submit button with and ID of SubmitButton.

The user may upload a file to the form and then submit the form. There is a form library in SharePoint to which to submit the InfoPath form instance, but there is also a document library in which the file attached to the form needs to be uploaded. A data connection for submission has been created ...

Get InfoPath with SharePoint® 2013 How-To now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.