2

I'm trying to create a sequential workflow using VS. I'm needing to loop through all the items in a list and send an email if one of the columns equals a specific status.

I have not found any good tutorials / documentation on sending emails from a VS workflow. Has anyone done this successfully? Any help is appreciated!

using: sharepoint 2010, visual studio 2010

Thanks,

2 Answers 2

2

There is a sendEmail activity that you can drop onto the designer. It is under SharePoint Workflow group.

You should be able to add the loop, the if check, and the send email activity to the designer and just set the fields as needed.

MSDN - SendEmail Activity Members

SendEmail Activity Tutorial on C# Corner

1
  • I've been spending so much time doing event receivers I had completely forgotten about that. I added a couple links to your answer so as to give ironman99 an example. Sep 21, 2012 at 18:16
0

Use SPUtility.SendEmail http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.sendemail.aspx

For example you might call it like this:

using System.Collections.Specialized;
using Microsoft.SharePoint.Utilities;

//Code defining class/WF methods, etc.

            //Build the headers.
            StringDictionary headers = new StringDictionary(); 
            headers.Add("content-type", "text/html");
            headers.Add("subject", "subject");
            headers.Add("from", "[email protected]");
            headers.Add("to", "[email protected]");
            SPUtility.SendEmail(item.ParentList.ParentWeb, headers, body.ToString());

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.