action & activity fundamentals developing a custom declarative activity developing a custom code...

26

Upload: gerard-norris

Post on 23-Dec-2015

229 views

Category:

Documents


1 download

TRANSCRIPT

Custom Workflow Activities& Actions for SharePoint 2013Hyong Guk KimSenior Program Manager, Microsoft

Session objectives• Understand how you can easily develop

custom activities and actions in Visual Studio and deploy them to SharePoint

• Understand how SharePoint and SharePoint Designer understand custom actions and activities

Agenda

Action & activity fundamentals

Developing a custom declarative activity

Developing a custom code activity

Agenda

Action & activity fundamentals

Developing a custom declarative activity

Developing a custom code activity

• Richer scenarios• Strong market needs for various and richer scenarios

• Partners & Eco system• Empowers partners in SharePoint workflow and tool business

market

• Workflow development productivity• Sharing the reusability enhances developers’ productivity

Why do you need custom activities?

• Activity & Action• Activity is a building block of a workflow and a unit of workflow

execution • Action is a high level wrapper of activity with a human readable

statement • N : 1 mapping

• .actions4 files• Successor of .actions file• Located in %CommonProgramFiles%\Microsoft Shared\Web Server

Extensions\15\TEMPLATE\1033\Workflow (farm-scoped)• Contain a list of workflow actions for WF4

Action & activity fundamentals

• Declarative & Coding• “Declarative” simply means “no coding”• “Declarative” defines a behavior of new activity or

workflow by composing existing activities without coding

• Declarative workflow was introduced in Office 2007 with code workflow

• Declarative activity was introduced in Office 2013

• Code activity• Code activities give you full access to .NET and might do

more things• On-Prem only

Action & activity fundamentals

• XOML & XAML• Declarative workflow definition file

SharePoint Workflow Manager

Action & activity fundamentals

SharePoint Designer 2007/2010

SharePoint Designer 2013

.xaml.rules

.xoml

WF3.x WF4.x

.rules

.xoml

WF3.x

• Activity types• WF4.5 activities• In .NET 4.5• System.Activities

• Workflow Manager activities • In Workflow Manager 1.0• Microsoft.Activities

• SharePoint activities• Microsoft.SharePoint.WorkflowServices.Activ

ities

• Project activities• Microsoft.Office.Project.Server.WorkflowActi

vities

• Custom activities

Action & activity fundamentals

WF4.5Activities

Workflow ManagerActivities

ProjectActivities

SharePointActivities

Custom Activities

• DynamicValue and Dictionary (SPD)• DynamicValue was introduced with Workflow Manager • Microsoft.Activities.DynamicValue

• DynamicValue allows you to create, store, and consume complex data structures• Implements ICollection, IDictionary, IEnumerable

• Perfect match for JSON

• Dictionary is wrapper type in SharePoint Designer for DynamicValue• Defined in workflow15.actions4

Action & activity fundamentals

Agenda

Action & activity fundamentals

Developing a custom declarative activity

Developing a custom code activity

• Prerequisites• SharePoint 2013• Workflow Manager 1.0• Visual Studio 2012 (Professional/Premium/Ultimate) on SharePoint box• Microsoft Office Developer Tools for Visual Studio 2012

• Development and deployment • Declarative activities are deployed as SharePoint solution package

(.wsp)• Managed at SharePoint Solution Gallery or Farm Solution Store

Developing a custom declarative activity

Demo

Developing a custom declarative activity

Agenda

Action & activity fundamentals

Developing a custom declarative activity

Developing a custom code activity

• Development• SharePoint or Workflow Manager box is not must for development• Code activity should be signed code of full trust

• Deployment• On-Prem only (not applicable to Office 365)• Should manually deploy activity to Workflow Manager box and

SharePoint box

Developing a custom code activity

• Deployment in detail• Workflow Manager box

1. Copy activity assembly to following locations:• %ProgramFiles%\Workflow Manager\1.0\Workflow\Artifacts• %ProgramFiles%\Workflow Manager\1.0\Workflow\WFWebRoot\bin

2. Add your activity class to the white-list• Create AllowedType.xml and copy it to above two locations

3. Restart “Workflow Manager backend” service

• SharePoint box1. Copy activity assembly to SharePoint box and GAC it2. Add a new .actions4 file to %CommonProgramFiles%\Microsoft Shared\Web Server

Extensions\15\TEMPLATE\1033\Workflow (need top-level node)3. Reset IIS

• Client• Clean up SPD cache (%LocalAppdata%\Microsoft\WebsiteCache)

Developing a custom code activity

Demo

Developing a custom code activity

Agenda

Action & activity fundamentals

Developing a custom declarative activity

Developing a custom code activity

• “Wow, but looks difficult.. Is there any other option I can take to surface platform activities without Visual Studio?”

- from post-session questions -

Yes, if you are in On-Prem environment, you can surface more platform activities to SharePoint Designer actions with a lot easier way. Here’s step:• Step 1. Copy “utility.actions4” file (attached above) to SharePoint workflow folder

(%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\15\TEMPLATE\1033\Workflow)

• Step 2. Reset IIS• Step 3. In the client machine, clean up SPD cache (%LocalAppdata%\Microsoft\WebsiteCache)

• Step 4. Launch SPD 2013• Step 5. Find if a new string action “Get String Length” is available. It should.

Why this is possible? Because your new action does not require a new “custom” activity. We are already providing “Expressions.StringLength” in Workflow Manager activities. Please find activities we are providing in the platform libraries (slide 11) and surface them. There are huge number of OOB activities you can easily surface on to your SPD.Please make sure you clean up client SPD cache. If not, you cannot open your workflows which use those new actions.

Tip utility.actions4

• SharePoint Designer Team Blog• http://blogs.msdn.com/b/sharepointdesigner

• MSDN & TechNet• Workflows in SharePoint 2013• Workflow actions schema reference• Install Visual Studio 2012, Office Developer Tools for Visual Studio 2012

, and client components

• SharePoint Designer for developers• Build and deploy workflow custom actions• Custom code activities and types in a Workflow Manager 1.0 workflow• Workflow Manager 1.0 Trusted Surface• Developing workflows with elevated permissions• Configure workflow in SharePoint Server 2013

References & resources

Related sessionsDeveloping SharePoint Workflows with SharePoint Designer 2013 and Visio Pro 2013

SPC089 / Breakout Session 13: Tuesday 5:00pm – 6:15pm

SharePoint 2013 Workflow Development for Apps and Full-Trust Solutions for SharePoint 2013 with Visual Studio 2012

SPC212 / Breakout Session 06: Tuesday 1:45pm – 3:00pm

What's New in Designing Workflows and Managing Work Requests With Project Online & Project Server 2013

SPC248 / Breakout Session 12: Wednesday 5:00pm – 6:15pm

SharePoint 2013 Workflow: Architecture and Configuration

SPC213 / Breakout Session 05: Tuesday 10:30am – 11:45am

Building SharePoint Designer-Based Workflows in SharePoint 2013

HOL008 / Thursday 12:00pm – 1:15pm

Building Visual Studio-Based Workflows in SharePoint 2013

HOL010 / Thursday 12:00pm – 1:15pm

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Download SharePoint Designer 2013 and try!http://www.microsoft.com/en-us/download/details.aspx?id=35491