1

I have been tasked with creating a SharePoint 2010 sandboxed workflow that essentially scans a custom list and sends emails to specific users when certain conditions for a given list item are true. It would be straightforward to use the method below to send the emails.

SPUtility.SendEmail(SPWeb, StringDictionary, String)

However, that method is blocked in sandboxed workflows. I have read that it is possible to start a declarative SharePoint Designer workflow (like the one that sends an email) programmatically, but I am unable to find a good step by step explanation on how this is done. Note the users I am sending emails to are dynamic, so I will need a parameterized solution. Thoughts?

1 Answer 1

2

Why don't you just use the Send Email workflow action from SharePoint Designer? If you save a SharePoint Designer workflow as a template, the WSP is a sandbox solution, and with a little manual copying you can deploy them in a sandbox solution yourself as well.

If you must send email from a custom workflow action, then you need to use the System.Net.Mail ASP.NET mail object, you can't use the SharePoint one. The only caveat is that you need to store and set the address of the SMTP service yourself (the SharePoint SPUtility automatically use the SMTP server configured in outgoing email settings).

2
  • Could you expand on "... with a little manual copying you can deploy them in a sandbox solution yourself as well."?
    – mbreske
    Commented Jul 19, 2011 at 23:05
  • 2
    When you save a SharePoint Designer workflow as a template, it creates a WSP that can be uploaded into the Solution Gallery of a Site Collection (Sandboxed Solution). WSP files are just .CAB files. Save the workflow as a Site Template, rename the .WSP to a .CAB and you will see it is just a normal WSP with a Manifest, Feature.Xml, Elements, etc. Copy the files into your own VS2010 sandbox solution project to mix and match with your own additional elements. Commented Jul 20, 2011 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.