Use an InfoPath form and SharePoint Designer workflow to send an email with attachments
In this InfoPath demo video you will see how you can use a custom workflow activity in a SharePoint Designer 2010 workflow to extract data and attachments from an InfoPath form that is submitted to a SharePoint form library, send an email with attachments, upload the attachments as documents to a SharePoint document library, and include a link to the InfoPath form in the email.
In recipe 100, you'll learn how to write C# code in Visual Studio 2010 to create a custom workflow activity that can send an HTML or plain text email based on data from an InfoPath form that has attachments, attach the file attachments to the email, upload the file attachments to a document library, and include a link to the form in an email.
Get more solutions from InfoPath 2010 Cookbook 3 which is available on Amazon.com
Watch next video: Convert an InfoPath form to Word and PDF in SharePoint 2010
InfoPath demo video transcript:
Here I'm in SharePoint 2010, and I've already published an InfoPath form template to a SharePoint form library called SubmitEmailOnSubmitLib.
The intention is that whenever an InfoPath form is submitted or saved in this form library a SharePoint Designer workflow will run. That SharePoint Designer workflow makes use of a custom SharePoint workflow activity that can extract file attachments from an InfoPath form, and send them in an email, but it can also upload those file attachments as documents to a SharePoint document library.
In this case, the documents will be uploaded to this document library called DocLib, which as you can see is currently empty.
So if I add a new form, and fill it out... because this is a Rich Text Box control I can apply formatting to the text such as change the font and the font size. I'll make the second line red and bold, and then I'll select this Send as HTML check box. You can also send the email as plain text if you like.
And then I'll attach a couple of documents. First I'll attach a Word document and then I'll attach an image. And then I'll save the form in the form library. Once the form has been saved, a SharePoint Designer workflow will run.
And then if we go to the SharePoint document library, you'll see that the two documents that I attached to the InfoPath form have been uploaded here to the document library.
And if we look at the email that was sent, you'll see that the documents are attachments in the email, and also that our formatting has been applied to our text, and a link to the form included within the email.
Related InfoPath Demo Videos:
- Submit/retrieve an entire InfoPath form to/from SQL Server
- Auto-number InfoPath forms in a SharePoint form library
- Convert an InfoPath form to Word and PDF in SharePoint 2010
- Use an InfoPath form to add a recurring all day event to a SharePoint calendar
- Use an InfoPath form to perform CRUD actions on an Access table with Memo field
- Submit an InfoPath form to a web service and then retrieve return values
- Select and add files from a document library as attachments to a form
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 of S.Y.M. Wong-A-Ton. 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, S.Y.M. Wong-A-Ton.