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.

Thursday, February 21, 2013

"User Not Found Error" when attempting to manually start SharePoint 2010 Workflow

So one morning I come in and try to manually start a workflow, and receive a generic "User Not Found" error when first clicking on the Workflow icon within an item.  I followed up and attempted to force a Workflow, and of course that did not work either.  Looking in the ULS logs I saw several of the following errors: 
"Microsoft.SharePoint.SPException: User cannot be found." 
So after wracking my brain as to what I did to cause this, I remembered I had done some cleanup on the _layouts/people.aspx?MembershipGroupId=0 (the individual listings of SP users in 2010) so I was worried I deleted a system account or worse, but everything current was there.

Off to the web I went and a majority of the posts were from Office 365 support forums which had a bunch of "please open a support case", but a few pages down I found this entry:
http://www.erinbglenn.com/Lists/Posts/Post.aspx?ID=28 from Erin Glenn, and this solved my issue.
Using SharePoint Designer to Check out then Check in all the workflow files within  "All Files, _Catalogs, wfpub" at the root site as she mentions did the trick.

Basically one of the accounts I deleted was an old SP Admin here, and sure enough his account was attached to one of the root workflow files she mentions in the blog post. 
So many thanks to Erin on this one.