Create a new SharePoint Sequential Workflow project.
Drag and drop SendEmail activity just after onWorkflowActivated1 activity .
Set CorrelationToken property of SendEmail to workflowToken which is the workflow correlation token used by onWorkflowActivated1.
For MethodInvoking set the value sendEmail1_MethodInvoking and click which would generate the handler.
private void sendEmail1_MethodInvoking(object sender, EventArgs e)
{
sendEmail1.To = “myId@g.com”;
sendEmail1.From = ” myId@g.com “;
sendEmail1.CC = ” otherId@g.com “;
sendEmail1.Subject = “MySubject”;
sendEmail1.Body = ” This is test mail”;
}
}
Strong sign the assembly and install it in GAC.
Set your feature.xml as following
<Feature Id=“23CB845A-7204-4d41-9873-FE50BEB78BCD“
Title=“Default Title“
Description=“This feature is a workflow that …“
Version=“12.0.0.0“
Scope=“Site“
xmlns=“http://schemas.microsoft.com/sharepoint/“>
<ElementManifests>
<ElementManifest Location=“workflow.xml“ />
</ElementManifests>
</Feature>
Id– Provide a new guid for uniquely identifying the feature
Title – to be displayed in the list of features deployed to the site
Description – Any description that appears beneath the Title.
Location – Leave it to default as the directory is same.
Set your workflow.xml as following
<Elements xmlns=“http://schemas.microsoft.com/sharepoint/“>
<Workflow
Name=“My Workflow“
Description=“This workflow …“
Id=“049971BB-5BAA-4bf1-98A2-747675A18DCB“
CodeBesideClass=“SharePointWorkflowLibrary3.Workflow1“
CodeBesideAssembly=“SharePointWorkflowLibrary3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=58efe34bdb2df93e“
>
<Categories/>
<MetaData>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
</Workflow>
</Elements>
Name – Name of the workflow.
Description – Any description about the workflow
Id – A new guid for the workflow
CodeBesideClass – Namespace.ClassName
CodeBesideAssembly – name of assembly, version , culture and publicKeyToken which we can get by right clicking the assembly in gac and selecting properties.
Remove all other entries as we are not using any forms for this workflow.
Now modify the install.bat file as mentioned in the instruction for the same.
Run install.bat
Next go to the site where the new workflow has been deployed.
Select any document library – than settings- document library settings – workflow settings – add a workflow.
We’ll see our workflow within the workflow template.
Correlation Token – A correlation token is essentially a means of uniquely identityfing each instance of a workflow, modification or task.
Bye…
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.
