Friday, June 14, 2013

Sending Attachments via SharePoint 2010 Workflow

Sending Attachments via SharePoint 2010 Workflow

We had a use case of certain users not having a laptop or home devices to access certain documentation that occasionally is sent out later in the evening or over the weekend.  It was decided that we would send attachments as part of the SharePoint workflow process, and of course SharePoint designer does not have that functionality. 
A quick search turned up the following codeplex project, by user Aozen.
http://sharepointstuff.codeplex.com/releases/view/66258

This is an amazingly simple download and install, and the product works without any issues at all.  I initially used it on a Document Library to send an individual attachment, but it also works with lists and multiple attachments (not sure if there is a limit to this, I have sent up to 5 smaller attachments, but of course your email system/SMTP on SharePoint may need to be tweaked if you want to move large files).


-------------------------------------------------

Installation Instructions (from Aozen's Codeplex link above)This solution must be deployed as a farm solution. It will not work as a sandboxed solution.

  1. Download the .wsp file from the download section
  2. Use the normal methods for adding the solution to the solution store (Stsadm or powershell)
  3. Log into central admin and deploy the solution. This adds a feature that you can activate at the web application level
  4. Go to Web application management in Central Administration. Select the web application that will use this activity. Click manage features in the ribbon. Activate the Send Email with attachment feature.
  5. Activating the feature adds a safe assembly line to the web config file.

How to use
  1. Open SharePoint Designer
  2. Navigate to the list / library you want to add a workflow to
  3. In the Actions drop down you should see a new section called SharePointStuff Custom Actions
  4. Select the Send Email With Attachment activity

Note
To send the emails the activity uses the SMTP server setup for the current web application in SharePoint. If outgoing email is not enabled on your farm you will need to enable it or you will get an exception.