using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using System.IO;
namespace EventHandler
{
public class TaskEventHandler : SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
//base.ItemAdded(properties);
SPListItem taskListItem = properties.ListItem;
SPFieldUser assignedTo = (SPFieldUser)taskListItem.Fields[SPBuiltInFieldId.AssignedTo];
SPFieldUserValue user = (SPFieldUserValue)assignedTo.GetFieldValue(taskListItem[SPBuiltInFieldId.AssignedTo].ToString());
SPUser userObject = user.User;
using (SPWeb web = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl))
{
bool isEmailServerSet = SPUtility.IsEmailServerSet(web);
if (isEmailServerSet)
{
bool appendHtmlTag = false;
bool htmlEncode = false;
string toAddress = userObject.Email;
string subject = "Tasks - " + taskListItem[SPBuiltInFieldId.Title] + " has been assigned to you";
StringBuilder sb = new StringBuilder("" + taskListItem[SPBuiltInFieldId.Title] + "has been assigned to you");
sb.Append("
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint;
namespace RevolutionTaskApp { class Program { static void Main(string[] args) { using (SPSite site = new SPSite(http://mossServer:7000)) { using (SPWeb web = site.RootWeb) { SPList list = web.Lists["Tasks"];