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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.