Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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,

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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

share|improve this answer
    
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. –  Robert Kaucher Sep 21 '12 at 18:16
add comment

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", "from@domain.com");
            headers.Add("to", "someaddress@domain.com");
            SPUtility.SendEmail(item.ParentList.ParentWeb, headers, body.ToString());
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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