How to Create WF with C#

I have learned about Workflow by dropping and clicking and the next phase is learn how to create WF with C# based this link

What material, link etc can you recommend me to learn about creating WF with C# coding? I have previous knowledge in, regular c# coding etc but not in relation to WF with C# code.

SharePoint Asked by What'sUP on January 8, 2021

2 Answers

2 Answers

Here is the good example to start with SP workflow using Visual studio.

Please follow the below steps:

1-Start with a Sequential Workflow. Start Visual Studio and create a new project from the template SharePoint --> Sequential Workflow.

2-In the next screen select the option Site Workflow.

3-In the next screen, leave the default option saying the user manually starts the Workflow.

4-Create Activity

What is an Activity?

A Workflow consists of a series of Activities. We can add Activities using the Toolbox. There are different types of Activities like Code Activity, SendEmail, etc.

5-Drag and drop a Code Activity from the toolbox.

6-Add code for the Activity, add code for this Activity. Double click on the codeActivity1

    private void codeActivity1_ExecuteCode(object sender, EventArgs e)
    using (SPWeb web = SPContext.Current.Web)
    SPList list = web.Lists["Manager"];
    foreach (SPListItem item in list.Items)
        if (item["Address"] == null)
            item["Address"] = "PLEASE SET THE ADDRESS!";


7-Build and Deploy the Solution.

Answered by Rishi Jagati on January 8, 2021

Add your own answers!

Related Questions

Create Folder and Upload File to Document Library

1  Asked on November 21, 2021 by chris-harrington


How to create list to track documents uploaded

1  Asked on November 17, 2021 by bstock


when try to open a MS project file, getting an issue.

2  Asked on November 15, 2021 by achiever-sp


Content Search WebPart: query Date and Time field

2  Asked on November 13, 2021 by akshay-dattatray-nangare


Ask a Question

Get help from others!

© 2022 All rights reserved.