Question

I've created a custom workflow which creates a task item when the workflow is kicked off. alt text http://img19.imageshack.us/img19/2862/screenshot310200942100p.png

I've also created a few custom content types for the document library and task list.

For the document library: First, I add a document library and configure it to allow custom content types. Then I add my content type, which is based off the document content type. After, I add a workflow under workflow settings. Here, I select my custom workflow, give it a name and tell sharepoint to create a New task list to store the tasks in.

For the task list: Now that I have a sharepoint created task list, I go there and allow custom content types and make sure "Send e-mail when ownership is assigned?" is set to Yes. Then I add my two custom content types which are both based off a workflow task content type. Thats all I should do.

When I start my workflow, it does add the approval task (I'm using a CreateTaskWithContentType activity which is named createApprovalTask), but no email is sent out for the created task.

The code I'm using in the createApprovalTask activity is:

// make a new GUID for this task
createApprovalTask_TaskId = Guid.NewGuid();
// set simple properties of task
createApprovalTask.TaskProperties.AssignedTo = "a valid domain\user";
createApprovalTask.TaskProperties.Title = "Review Contract: " + approvalWorkflowActivated_WorkflowProperties.Item.DisplayName;
createApprovalTask.TaskProperties.SendEmailNotification = true;

If I create a document library and use one of Sharepoint's built-in workflows (Approval for example), and tell it to create a task list for it, when an item is added to that list, it sends out the email correctly. So, the setting for the outgoing mail server are correct, as we're receiving other emails just fine.

I'm using a SendEmail activity right after the createApprovalTask activity to send an email back to the submitter telling them we've received their approval request. The code for that is something similar to:

sendApprovalRecievedEmail.Body = emailBody;
sendApprovalRecievedEmail.Subject = emailSubject;
sendApprovalRecievedEmail.To = emailTo;
sendApprovalRecievedEmail.From = emailFrom;

This works, so the submitter receives their custom email, but the task owner never receives the task item email.

Was it helpful?

Solution

Unfortunately, our mail servers were blocking the emails for some reason. I wasted a good 2 1/2 days searching around for this problem...and it turns out our IT department didn't have their sh*t together.

Thanks everyone.

OTHER TIPS

you have to make sharepoint outgoing email settings properly. example is shown in below link

http://sharepoint-amila.blogspot.com/2008/02/outgoin-email-settings.html

if you need to send an email through the c#.net code you can use below method to send emails in custom workflows. SPUtility.SendEmail Method (Microsoft.SharePoint.Utilities)

example is shown in below link http://www.sharepoint-amila.blogspot.com/

Is it possible to point out a SharePoint user by "domain\user" like you do with createApprovalTask.TaskProperties.AssignedTo? Isnt the ID required?

"id;#domain\username"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top