.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Workflow Activities in SharePoint

Posted By:Jean Paul       Posted Date: August 22, 2013    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we can explore more about the Workflow Activities inside Visual Studio 2010.

In this article we can explore more about the Workflow Activities inside Visual Studio 2010.


A Workflow consists of Activities and an Activity represents a Modular Step in a Workflow.  They are compiled and get executed in the Server Side.

Starting With

For starting with create a new Sequential Workflow project inside Visual Studio 2010.

For starting with create a new Sequential Workflow project inside Visual Studio 2010.


Visual Studio IDE provides 3 set of Activities named:
1.  Windows Workflow v 3.0
2.  Windows Workflow v 3.5
3.  SharePoint Workflow
They are accessible from the Toolbox window as shown below:

Now we can explore some of the important Activity items in the Toolbox.

Code Activity

We can write custom code using the Code Activity. 

The custom code can be specified through an event handler.

 private void codeActivity1_ExecuteCode(object sender, EventArgs e)


IfElse Activity

The IfElse Activity allows branching of execution depending on the condition.

The If & Else conditions can be specified using the Properties window.

While Activity

This activity repeatedly executes the code as long as a condition is True.

We have to drop activities inside the While Activity and set the condition of execution.

Event Driven Activities

Event Driven Activities are not executed during the workflow execution.  Instead they are executed when the event occurs.
For example:
·  OnTaskChanged activity gets executed when the involved Task changes.
·  OnWorkflowItemDeleted activity gets executed when the involved workflow item is deleted.
Following are the Event Driven Activities inside Visual Studio activities:


For all the activities where a property for Condition was found, you can see there are 2 options:

The 2 options are:
1.  Code Condition
2.  Declarative Rule Condition
Code Condition resides in the assembly and specifies the condition through code (actually an event).  For example:

private void ConditionHandler(object sender, ConditionalEventArgs e)
  if (this.CustomPropertyValue > 10)
  e.Result = true;
  e.Result = false;

Declarative Rule Condition resides in the Workflow XML file and uses an Expression to evaluate the condition.  The Expression Builder inside Visual Studio allows editing the expression.

Categorized Activity Table

Following is the categorized table of Activities:

Code Executes associated code
CallExternalMethod Invokes an external method

Branching, Looping
IfElse Executes activities based on condition
While Iterates execution of activities based on condition

Control Flow
Suspend Suspends execution of workflow
Terminate Terminates execution of workflow

WCF & Web Service
ReceiveActivity WCF receive activity
SendActivity WCF send activity

CreateTask Create task for a workflow
UpdateTask Update task of a workflow
DeleteTask Delete task of a workflow
UpdateAllTasks Updates multiple tasks of a workflow
RollbackTask Roll back a task status to last state
LogToHistoryList Logs information on execution to workflow history list
OnTaskCreated Event driven activity
OnTaskChanged Event driven activity
OnTaskDeleted Event driven activity




In this article we have explored Visual Studio Activities.  Please note that in the real world scenarios we can create our own custom activities.   
In the upcoming chapter we can create a workflow with the existing activities.

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend