Presentation is loading. Please wait.

Presentation is loading. Please wait.

SharePoint Workflow Development Using Visual Studio Brian LaSitis February 27, 2008.

Similar presentations


Presentation on theme: "SharePoint Workflow Development Using Visual Studio Brian LaSitis February 27, 2008."— Presentation transcript:

1 SharePoint Workflow Development Using Visual Studio Brian LaSitis February 27, 2008

2 Topics  Why use Visual Studio vs. SP Designer?  Advantages & Disadvantages  Windows WF Overview  General Concepts & Usage Scenarios  Workflow Types  Activity Overview  SharePoint WF Extensions  Custom Workflow Solutions  Demo  Custom SP Designer Actions  Demo

3 SharePoint Designer - Workflow AdvantagesDisadvantages  Targets the Information Worker  Allows business users to apply simple business logic within a document library or list  Uses a rules-based approach, similar to the Rules Wizard in Outlook  Can be deployed without installing custom code to a server  Default capabilities limited to the actions available out of box  Limited wide-deployment options since each workflow is inherently tied to a specific list/document library  Does not support state-machine workflows  Workflows cannot be modified while they are executing

4 Visual Studio / Windows WF AdvantagesDisadvantages  Graphical, flow-chart like development tools.  Builds upon WF foundation, and adds SharePoint-specific activities.  Supports custom association, initiation, modification, and task forms.  Allows deployment through use of SharePoint features.  Requires significant knowledge of the.NET development and the WF framework.  Requires custom code to be deployed to the SharePoint server.  Requires the developer to fully understand the underlying business logic of the workflow process.

5 SharePoint Features Overview  Modular framework for deploying functionality within a specific scope within SharePoint:  Farm  Web Application  Site Collection  Web Site  Stored within 12\TEMPLATE\FEATURES.  Must be installed and activated to be used within their configured scope.  Can be “stapled” to existing site collections, including those provided out-of-the-box.

6 What is Windows WF?  A pillar within the.NET Framework 3.0 that provides the programming model, engine, and toolset for creating workflows in Windows  Not product specific; leveraged by many products.  In its most basic form, WF is a multithreaded execution engine that can be leveraged by any type of.NET application  Graphical development tools are directly integrated with Visual Studio 2005, through the Windows WF Designer.

7 WF Usage Scenarios  Windows WF can be leveraged for any of the following:  Workflow within LOB applications  Windows Forms / ASP.NET UI Page Flow  Document-centric workflow  Human workflow  Composite workflow for SOA  Business rule-driven workflow  Workflow for systems management

8 What products use Windows WF?  Windows SharePoint Services 3.0  Microsoft Office SharePoint Server 2007  Microsoft BizTalk Server 2006 R2  Microsoft Dynamics CRM 4.0  Microsoft Identity Integration Server

9 A WF Workflow Definition  Can be one of three types: sequential, state-machine, or rules-based.  Composed of a set of activities, that are interconnected to form a business process. SequentialState-MachineRules-Based Ideal for business processes Ideal for processes with external interaction Ideal for complex decision scenarios Typically execute autonomously without external interaction Typically are reliant upon outside control to complete execution Typically use large, chained rule-trees to drive execution Execution controlled by the workflow itself Events control the workflow execution Rules & policies control workflow execution Root Activity: SequentialWorkflow Root Activity: StateMachineWorkflow Either state-machine or sequential can be used.

10 Common WF Activities Activity NameDescription Sequence ActivityComposite activity that executes the set of activities within it in a sequential fashion. Code ActivityExecutes a snippet of.NET code. IfElse ActivityImplements If-Then-Else conditional logic within a workflow. While ActivityImplements looping logic within a workflow. Parallel ActivityComposite activity that executes two or more Sequence activities in a cooperative multithreaded manner. CallExternalMethod ActivityInvokes an external (.NET) method on an object, as defined in an interface bound to the activity.

11 The Workflow Runtime  The Workflow Runtime is responsible for coordinating the following events:  Starting workflow instances  Invoking workflow events  Tracks and uses pluggable services for providing functionality such as transactions, persistence, and tracking.  Only one Workflow Runtime can exist within the application executing the workflow.  Windows Forms, Console, ASP.NET applications  Windows Services  SharePoint

12 SharePoint Workflows in WF  SharePoint extends the WF foundational framework by adding new workflow activities.  Visual Studio add-ins are installed as part of the SharePoint 2007 SDK; supported by VS 2005 & 2008.  It is advisable to perform the development of SharePoint WF workflows on an actual server running SharePoint.  Results in simplified development and deployment since assembly references and post-build deployment steps are automated using the default project templates.  The development of custom workflow actions in Visual Studio that are callable from SP Designer workflows is also possible.

13 Custom Workflow Forms  SharePoint WF-based workflows can be configured to use a custom form for association, instantiation, and modification, as well as custom task forms.  These can be implemented as ASPX forms or as InfoPath web- enabled forms (MOSS only) Form TypeDescription AssociationUsed to capture information when a workflow is associated with a list or document library. InitiationUsed to capture information when a workflow is manually started for an item by a user. Task CompletionUsed to capture custom information when a workflow participant completes a task. ModificationUsed to capture changes for processing workflows, if they are modified externally.

14 SharePoint WF Activities Activity NameDescription OnWorkflowActivated ActivityStarting activity for all SharePoint WF workflows; can accept inputs from Association & Initiation forms. CreateTask ActivityCreates a new task for a given user in the workflow. OnTaskChanged ActivityCaptures changes to a task that affect workflow processing. SendEmail ActivitySends email to a person or group of people. LogToHistoryList ActivityAllows entries to be written to a workflow’s History list, for tracking purposes. OnWorkflowModified ActivityAccepts inputs from the Modification form to change a workflow’s behavior.

15 SharePoint WF Development Tasks  Create a SharePoint Sequential or State Machine workflow project within Visual Studio 2005.  Add and configure activities on the WF design surface.  Create any necessary custom forms (InfoPath or ASP.NET-based)  Create a workflow.xml file.  Create a SharePoint feature for deploying the workflow and custom forms (if any).

16 Demo  WF Workflow Example – Content Submission  Process the serial approval of an item within a document library.  Upon approval, the document is automatically moved to a secured document library.

17 Custom SP Designer Actions  Allows custom logic to be leveraged in SP Designer workflows.  All built-in actions within SP Designer are custom WF activities  Defined in 12\TEMPLATE\1033\WORKFLOW\WSS.ACTIONS  Custom actions are created within Windows WF Activity Library projects in Visual Studio  New actions require a one-time server deployment process, yet they can be leveraged on any SP Designer workflows that are developed.  No client deployment is required.

18 Custom Action Development Tasks  Create a new Workflow Activity Library project in Visual Studio 2005.  Create 1 or more DependencyProperties for handing custom action inputs and outputs.  Define custom execution logic using Workflow activities or by overriding the Execute method of the custom activity being developed.  Create a.ACTIONS file (XML), describing the custom action.  Deploy to 12\TEMPLATE\1033\WORKFLOW  Deploy assembly to GAC and add an authorizedType entry in the web.config for it.

19 SP Designer Auto-Properties  The following properties, if defined on a custom SP Designer workflow action, are auto-populated with data at runtime. Property NameAssigned Value.NET Data Type __ActivationPropertiesThe activation properties data for the running workflow instance. Microsoft.SharePoint.Workflow.SPWo rkflowActivationProperties __ListIdString containing the GUID for the list the workflow is defined on. System.String __ListItemInteger value for the list item the workflow instance is running on. System.Int32 __ContextThe context object for the running workflow instance. Microsoft.SharePoint.WorkflowAction s.WorkflowContext

20 Demo  Custom SharePoint Designer Workflow Action  Create sub-site using input parameters of Site Title and Site Description.

21 Wrap-up  Custom-developed Windows WF solutions are supported on the SharePoint 2007 platform:  Sequential & State Machine workflows  Custom activities (actions) for use in SP Designer  Decision factors to determine the technology to use:  Developer skillsets  Information Worker roles vs. Developer roles  Reusability needs  Governance policies in place  Questions?


Download ppt "SharePoint Workflow Development Using Visual Studio Brian LaSitis February 27, 2008."

Similar presentations


Ads by Google