Select and add files from a document library as attachments to a form

In this InfoPath demo video you will see how you can use an InfoPath form to download a file from a SharePoint document library and add it as an attachment to the InfoPath form.

In recipe 94, you'll learn how to write C# code in InfoPath 2010 that can download a document from a SharePoint document library and add it as an attachment to an InfoPath form.

Get more solutions from InfoPath 2010 Cookbook 3 which is available on
Watch next video: Submit/retrieve an entire InfoPath form to/from SQL Server

InfoPath demo video transcript:

Here I'm in SharePoint 2010 where I've got this Documents SharePoint document library that contains documents which I would like to select and add to an InfoPath form.

I've already created and published an InfoPath form template to this SharePoint form library, so if I click Add document to add a new form, you'll see that as soon as the InfoPath form opens, it displays a list of all of the documents contained in the Documents SharePoint document library.

So now it's just a matter of selecting one of these files, and clicking Add File to pull that document down from the SharePoint document library and add it here as an attachment in the InfoPath form.

I can repeat the process for another file... and as you can see, it has been added here to the InfoPath form.


Related InfoPath Demo Videos:


Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers