TransWikia.com

How to Create WF with C#

SharePoint Asked by What'sUP on January 8, 2021

I have learned about Workflow by dropping and clicking and the next phase is learn how to create WF with C# based this link
(http://channel9.msdn.com/Series/Reimagine-SharePoint-Development/Translating-Custom-Code-Workflows-to-SharePoint-2013)

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

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!";

            item.Update();
        }
      }
     }
    }

7-Build and Deploy the Solution.

Answered by Rishi Jagati on January 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP