If we want to alert user when a new item is created or uploaded in a particular list or document library, we can do this by using workflow.
First, we have to create a new project in Visual Studio 2008 by click on
Then, select Visual C#–>Office–>2007–>SharePoint 2007 Sequential Workflow.
Now, give a name of the Workflow and click on Ok. It will go to the next screen named “New Office SharePoint Workflow“. We are providing the site url where we want to debug the Workflow and click on Next. Now we have to select the Library or List from the drop down list. Workflow will work on the selected list. Now click on Next.
This screen will give us the option to select the workflow starting process. Here, We are selecting all the options and click on Finish.
Now we are in the workflow design screen. Just double click on onWorkflowActivated1 and it will take us to onWorkflowActivated1_Invoked event.
We have to add Microsoft.SharePoint.Utilities Namespace with the existing Namespaces. This Namespace will help us to send Email.
Now, inside the on WorkflowActivated1_Invoked event, we have to write the following code:-
SPUtility.SendEmail(workflowProperties.Web, true, true, “Email Address where to send the mail”, “Subject Of the Mail”, “Body Of The Mail”);
We have to debug the solution then, and after that workflow will work.