210 likes | 416 Views
SharePoint Workflow Development Using Visual Studio. Brian LaSitis February 27, 2008. Topics. Why use Visual Studio vs. SP Designer? Advantages & Disadvantages Windows WF Overview General Concepts & Usage Scenarios Workflow Types Activity Overview SharePoint WF Extensions
E N D
SharePoint Workflow DevelopmentUsing Visual Studio Brian LaSitis February 27, 2008
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
SharePoint Designer - Workflow Advantages Disadvantages • 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
Visual Studio / Windows WF Advantages Disadvantages • 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.
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.
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.
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
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
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.
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
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.
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)
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).
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.
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.
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.
SP Designer Auto-Properties • The following properties, if defined on a custom SP Designer workflow action, are auto-populated with data at runtime.
Demo • Custom SharePoint Designer Workflow Action • Create sub-site using input parameters of Site Title and Site Description.
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?