Skip to main content

How to create custom Visual Studio 2005 workflows for WSS 3 or Office SharePoint Server 2007


Creating a custom Visual Studio 2005 workflow for SharePoint

Building workflows for SharePoint is a challenging programming exercise, which is best tackled in small steps.
Once you have learned how to deploy your first workflow, you can concentrate on learning how to use and implement the Workflow Foundation activities that are specific to SharePoint.
Creating Visual Studio 2005 workflows for SharePoint is a 2-step process:
  1. Design and write code for the workflow in Visual Studio 2005.
  2. Deploy the workflow to a SharePoint server.
In this tutorial, you will create a very simple and basic workflow, so that you have a workflow you can deploy to SharePoint and concentrate on getting through your first deployment of a custom Visual Studio 2005 workflow to SharePoint instead of dealing with the difficulties of implementing workflows for SharePoint.


To create a custom Visual Studio 2005 workflow:
  1. In Visual Studio 2005, create a new Project that is based on the Sequential Workflow Librarytemplate.
  2. In the Solution Explorer, double-click the Workflow1.cs file to open the workflow designer.
  3. Drag a LogToHistoryListActivty from the Toolbox and drop it under theonWorkflowActivated1 activity of the workflow.

  1. Figure 1. Basic Sequential Workflow in Visual Studio 2005 for deployment to SharePoint.
  2. Select logToHistoryListActivity1, and set its HistoryDescription property in the Propertieswindow to The workflow has run..
  3. Build the workflow project.

Installing the workflow on SharePoint

You can now proceed to deploying the Visual Studio 2005 workflow to SharePoint.
To deploy the Visual Studio workflow to SharePoint, you must:
  1. Make the compiled DLL of the workflow a strong named assembly by signing it with a strong name key.
  2. Deploy the assembly to the Global Assembly Cache (GAC) and retrieve its publicKeyToken. You will use the publicKeyToken in the workflow.xml file.
  3. Add the appropriate XML to the feature.xml and workflow.xml files.
  4. Modify the install.bat file by following the instructions in it. You can perform a Find and Replace to change the name of the workflow’s Feature folder and change localhost to point to your SharePoint server.
  5. Run the install.bat file to install the workflow on SharePoint.
Once you have installed the workflow, you must associate the custom Visual Studio 2005 to a SharePoint list or library.

Running the workflow on a SharePoint list or library


In the following example, I created a custom SharePoint list called MyFirstWorkflowList and associated it with the workflow. I named the workflow attached to the list MyFWF and set it to run whenever a new item is created.
In the figure below, you can see that a workflow instance has run on a newly created item.
A workflow instance has completed on a SharePoint list item.

Figure 2. A workflow instance has completed on a SharePoint list item.
If you click on the text Completed in the MyFWF column, you will open the Workflow Status page, where you will see the comment The workflow has run. in the Workflow History list.
The Workflow Status page of the workflow instance that ran on the SharePoint list item.

Figure 3. The Workflow Status page of the workflow instance that ran on the SharePoint list item.

                                

Comments

Popular posts from this blog

Tab Control in Asp.Net

Scenerio: I need your help in designing tab control in   asp.net .My requirement is I need a tab control in   asp.net (C#) like  for example goto my computer ,right click c drive and select properties.we get tabs like general,security etc....... like that i need to design one tab control(no need of any rightclick) in my web page and the database table columns should come as tabs and inseide the tab data of that particular column should come.   Example:Employee master tab1:Employee name.........his name in the tab tab2:Age.............his age tab3:Address........his address   Solution:   You can do this using a simple div <style type="text/css"> .tabs         {             position: relative;             height: 20px;             margin: 0;   ...

AI and Microsoft: Revolutionizing Efficiency in Nonprofit Organizations

  How AI and Microsoft Enhance Efficiency in Nonprofit Organizations In today’s fast-paced world, nonprofit organizations face unique challenges—limited resources, increasing demands, and the constant need to do more with less. But what if technology could be the game-changer they need? In my latest research paper,  "How AI and Microsoft Enhance Efficiency in Nonprofit Organizations" , I explore how cutting-edge technologies like Artificial Intelligence (AI) and Microsoft’s innovative tools are revolutionizing the way nonprofits operate. From streamlining administrative tasks to enhancing donor engagement and optimizing resource allocation, AI and Microsoft’s solutions are empowering nonprofits to focus on what truly matters—their mission. This paper dives deep into real-world examples, practical applications, and the transformative potential of these technologies. Whether you’re a nonprofit professional, a tech enthusiast, or simply curious about the intersection of technolo...

Social tagging overview in Sharepoint 2010

A tag is a word or phrase that identifies an individual piece of information according to a set of attributes or criteria. Tags make it easy to find and share information about a specific subject or task. Social tagging helps users categorize information in ways that are meaningful to them. Social tagging can improve the quality of search results by filtering against specific tags, and it can also connect individuals who want to share information with other users who have like interests. This article describes the social tagging features in Microsoft SharePoint Server 2010. This article does not describe how to configure social tagging features. It also does not discuss how to implement social tagging features as part of an overall social media strategy for an enterprise. About using social tagging features Social tagging features help users to share information and to retrieve relevant, high-quality content more efficiently. Such sharing encourages collaboration and b...