January 26, 2013

// // Leave a Comment

Send SharePoint List Attachment link in Email through Sequential Workflow

1)      Open the Visual Studio and run as Administrator

2)      File → New Project → Installed Templates → SharePoint → 2010 → Sequential Workflow

Give name and Select the Location.

Select the site and click next. If you want can give Validate also.

Give name of the work flow and select list work flow . Click next...

Select the list to associate and click next.


Specify the conditions on which the work flow should work and click Finish


Workflow1.cs[Design] file opens up.
In this file drag “sendEmail” from toolbox under sharepoint below onworkflowActicated1 box.
The resulting looks like below.

Right click sendEmail1 and goto properties.
Under properties Find Correlation Token and select workflowToken and OwnerActivityName to Workflow1

Find the To properties for sendEmail1 and click on the … Button.

In the bind to an activity window, Select the tab Bind to a new member and Select the Create Field and Click OK

10)  Do the same step 9 to Subject and Body properties.
The resulting image will be like this after changing the Body,Subject and TO properties.


Open the workflow1.cs file (Code File) and add the below code .

private void sendEmail1_MethodInvoking(object sender, EventArgs e) {

            SPListItem myListItem = workflowProperties.Item;

            string url = myListItem.Attachments.UrlPrefix + myListItem.Attachments[0];
                sendEmail1_To1 = "email@domain.com";

                sendEmail1_Subject1 = "Email Subject";

                sendEmail1_Body1 = "Dear All Please find the attachment link" + url ;


Build and deploy . After successful deployment test the list where the workflow was targeted.


Post a Comment