0
Advanced SharePoint 2013 Workflow for
Developers
PAOLO PIALORSI, PIASYS
PAOLO@PIALORSI.COM

SHAREPOINT AND PROJECT CONFERE...
sponsors
Something about me
• Consultant, project manager and trainer
• More than 40 Microsoft certification exams passed
• Microso...
Agenda
• SharePoint 2013 and Workflow Manager (quick recall)
• Advanced workflows with SharePoint Designer 2013
• Custom a...
SHAREPOINT 2013 AND WORKFLOW
MANAGER
SharePoint 2013 and Workflow Manager
Access Control

SharePoint 2013
Content

People

Sharing

2010 WF

OAuth

_API (REST ...
ADVANCED WORKFLOW WITH
SPD2013
Native Actions/Conditions are not enough …
But something is missing …
• Move File
• Upload File
• Search
• Publish/Approve Document
• Save data on a backend database...
BUT WE HAVE
REST APIS
• Support XML/OData/JSON format
• Can be used to query (OData)
contents
• Can be used to manage
(add...
_api Reference
Web Application Hostname

API Namespace

http(s)://{Host Name}/{site}/_api/{namespace}/

{object}
{property...
Sample URLs
• _api/web/lists
• _api/web/lists/getByTitle(‘Documents')
• _api/web/Lists/getByTitle('Documents')/Items
• _ap...
USING REST API FROM WORKFLOWS IN
SPD2013
CUSTOM ACTIONS AND ACTIVITIES WITH
VISUAL STUDIO 2013
Custom Activities vs Custom Actions
Custom Activity

Custom Action

• Custom element from Visual
Studio perspective
• Mini...
We can create libraries of custom actions
• Reusable in multiple workflow definitions
• Reusable in multiple site collecti...
CREATING A CUSTOM ACTION FOR SPD2013 IN
VS2013
(PART 1)
Creating a Custom Action (recap)
• Create a Sandboxed Solution
• Add a «Workflow Custom Activity»
• Design the markup-base...
Creating a Custom Activity (reference
only) a Workflow «Activity Library» project
• Create
• Add a class and inherit from ...
WORKFLOW SECURITY
A Workflow is like an App
• The workflow engine has an App Principal
• You can manage app principals:
• https://{hostname}...
Default permission model
• By default a workflow has write only permissions
• And while working leverages both
• User perm...
CREATING A CUSTOM ACTION FOR SPD2013 IN
VS2013
(PART 2)
App Step and AppOnlySequence (recap)
• You can configure a web site to «Allow workflows to use app
permissions»

• Assign ...
WORKFLOW FORMS
Understanding Workflow Forms
• Every workflow definition can have
• Association Form: to associate a workflow definition t...
Workflow Forms and Kind of Projects
• In Full Trust workflow projects
• Can run server-side code (SharePoint Server Object...
Workflow Services Manager

Workflow Services Manager
Deployment
Service

Instance
Service

Subscription
Service

Messaging...
CREATING CUSTOM WORKFLOW FORMS
questions?
HTTP://WWW.SHAREPOINTREFERENCE.COM/BLOG/

@PAOLOPIA
thank you.
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013
Upcoming SlideShare
Loading in...5
×

Advanced SharePoint 2013 Workflow for Developers

4,716

Published on

SharePoint 2013 introduces the renewed workflow engine. In this session, you learn some advanced topics about developing workflows with Microsoft Visual Studio 2012/2013. In particular, you learn how to create custom actions to extend SharePoint Designer 2013, how to create custom workflow forms, and how to leverage the Workflow Services Manager engine to automate and manage workflows.

This session targets .NET developers with a good experience in the fields of workflows development and/or process management.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
  • Hi, in the slide 15 you mentioned that it is possible to implement custom conditions within sandbox solutions. I can't find any way to do that. Are you sure it is possible?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
4,716
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
110
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide
  • Fiddlerhttps://pialorsi.sharepoint.com/sites/Workflows/_api/web/Lists/GetByTitle('Documents')/Items?$select=ID,TitlePoi SPD2013
  • Show MoveFile Custom Action in VS2013and in SPD2013 (skip security)
  • http://msdn.microsoft.com/en-us/library/jj822159.aspx
  • Show AppOnly deployment and security in MoveFile
  • http://msdn.microsoft.com/en-us/library/jj822159.aspx
  • Show Custom WF Forms with Init and TaskResult before, code after
  • Transcript of "Advanced SharePoint 2013 Workflow for Developers"

    1. 1. Advanced SharePoint 2013 Workflow for Developers PAOLO PIALORSI, PIASYS PAOLO@PIALORSI.COM SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013
    2. 2. sponsors
    3. 3. Something about me • Consultant, project manager and trainer • More than 40 Microsoft certification exams passed • Microsoft Certified Solution Master – Charter SharePoint • Focused on SharePoint since the beginning • Author of 10 books about XML, SOAP, .NET, LINQ and SharePoint • • • Microsoft SharePoint 2010 Developer Reference, Microsoft Press Microsoft SharePoint 2013 Developer Reference, Microsoft Press Build Windows 8 Apps with Microsoft Visual C# and Visual Basic Step by Step, Microsoft Press • Speaker at main IT conferences
    4. 4. Agenda • SharePoint 2013 and Workflow Manager (quick recall) • Advanced workflows with SharePoint Designer 2013 • Custom actions and activities with Visual Studio 2013 • Workflow Security • Workflow Forms
    5. 5. SHAREPOINT 2013 AND WORKFLOW MANAGER
    6. 6. SharePoint 2013 and Workflow Manager Access Control SharePoint 2013 Content People Sharing 2010 WF OAuth _API (REST OM) Workflow Manager Workflow Services Manager Instances Deployment Interop Messaging WF Service Application Proxy Workflow Client SharePoint Designer Visual Studio Events Service Bus
    7. 7. ADVANCED WORKFLOW WITH SPD2013
    8. 8. Native Actions/Conditions are not enough …
    9. 9. But something is missing … • Move File • Upload File • Search • Publish/Approve Document • Save data on a backend database • Etc.
    10. 10. BUT WE HAVE REST APIS • Support XML/OData/JSON format • Can be used to query (OData) contents • Can be used to manage (add, update, delete) content • Make the Client Side Object Model (CSOM) remotely available via REST • Useful for JavaScript/jQuery consumers • But also for workflows in SPD2013 or Visual Studio 2012/2013 _api is new alias for _vti_bin/client.svc Server Client REST OData JSON CSOM JavaScript Library Silverlight Library Custom Client Code .Net CLR Library
    11. 11. _api Reference Web Application Hostname API Namespace http(s)://{Host Name}/{site}/_api/{namespace}/ {object} {property} {indexer(index)} {method({parameter},{parameter},…)} Site Collection (Optional) Operation
    12. 12. Sample URLs • _api/web/lists • _api/web/lists/getByTitle(‘Documents') • _api/web/Lists/getByTitle('Documents')/Items • _api/web/Lists/getByTitle('Documents')/Items(4) • _api/web/CurrentUser • _api/web/SiteUsers • _api/web/getAvailableWebTemplates(lcid=1033) • _api/web/RoleAssignments/GetPrincipalId(1)/Member
    13. 13. USING REST API FROM WORKFLOWS IN SPD2013
    14. 14. CUSTOM ACTIONS AND ACTIVITIES WITH VISUAL STUDIO 2013
    15. 15. Custom Activities vs Custom Actions Custom Activity Custom Action • Custom element from Visual Studio perspective • Minimal functional element of a workflow definition • Custom element from SPD2013 perspective • Wraps an activity or an aggregation of activities • Can be an Action or a Condition • Reusable in SharePoint Designer • Deployable through Sandboxed Solutions • Supported in Office 365! • Defined one time, reusable many times • Come in two flavors • Declarative: XAML • Code based: .NET Type • Reusable in Visual Studio and in SharePoint Designer • Complex deployment • Not available in Office 365!
    16. 16. We can create libraries of custom actions • Reusable in multiple workflow definitions • Reusable in multiple site collections • Maintainable (are based on WSP, and WSP are upgradable …) • Some «common» examples • • • • Create New List/Library Delete List/Library Publish a document «Pending» approval Invoke remote HTTP services (REST/JSON/OData)
    17. 17. CREATING A CUSTOM ACTION FOR SPD2013 IN VS2013 (PART 1)
    18. 18. Creating a Custom Action (recap) • Create a Sandboxed Solution • Add a «Workflow Custom Activity» • Design the markup-based activity • You can’t use code • Define the .actions4 file • It will be registered in the target site collection • Package and deploy the WSP • Close SPD2013 and clear cache • C:Users{UserName}AppDataLocalMicrosoftWebsiteCache{site} • Restart SPD2013 and use the custom action
    19. 19. Creating a Custom Activity (reference only) a Workflow «Activity Library» project • Create • Add a class and inherit from the proper base Activity type • CodeActivity, CodeActivity<T> • AsyncCodeActivity, AsyncCodeActivity<T> • NativeActivity, NativeActivity<T> • Implement .NET code • Create an .actions4 file • It will be placed in TEMPLATE{LCID}Workflow folder • Add the assembly to the Global Assembly Cache (GAC) • Create an AllowedTypes.xml file • %ProgramFiles%Workflow Manager1.0WorkflowArtifacts • %ProgramFiles%Workflow Manager1.0WorkflowWFWebRootbin • IISRESET + Restart «Workflow Manager Backend» service • Close SPD2013, clear cache, restart SPD2013 and use the activity
    20. 20. WORKFLOW SECURITY
    21. 21. A Workflow is like an App • The workflow engine has an App Principal • You can manage app principals: • https://{hostname}/sites/{site}/_layouts/15/appprincipals.aspx?Scope=Web • https://{hostname}/sites/{site}/_layouts/15/appinv.aspx • https://{hostname}/sites/{site}/_layouts/15/appregnew.aspx
    22. 22. Default permission model • By default a workflow has write only permissions • And while working leverages both • User permissions • Workflow App permissions User Permissions App Permissions Workflow Permissions
    23. 23. CREATING A CUSTOM ACTION FOR SPD2013 IN VS2013 (PART 2)
    24. 24. App Step and AppOnlySequence (recap) • You can configure a web site to «Allow workflows to use app permissions» • Assign «Full Control» to the workflow App Principal (appinv.aspx) <AppPermissionRequests> <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" /> </AppPermissionRequests> • And Trust it!
    25. 25. WORKFLOW FORMS
    26. 26. Understanding Workflow Forms • Every workflow definition can have • Association Form: to associate a workflow definition to a target (0 or 1) • Initiation Form: to start a workflow instance on a target (0 or 1) • Task Forms: to provide custom UI for tasks (0 or more) • Are common ASPX pages • Visual Studio 2012/2013 provides item templates for • Association and Initiation • You need to manually define task forms • Leveraging custom Workflow Task content types and custom task lists
    27. 27. Workflow Forms and Kind of Projects • In Full Trust workflow projects • Can run server-side code (SharePoint Server Object Model) • Can do averything (they are full-trust) • Are not support for cloud-based (Office 365) deployments • In App for SharePoint projects • Workflows are available in app-web only • In a SharePoint-hosted app-web you can run only JavaScript code (!) • The form templates provided by Visual Studio are JavaScript based • You will have to interact with the Workflow Services Manager
    28. 28. Workflow Services Manager Workflow Services Manager Deployment Service Instance Service Subscription Service Messaging Service Interop Service
    29. 29. CREATING CUSTOM WORKFLOW FORMS
    30. 30. questions? HTTP://WWW.SHAREPOINTREFERENCE.COM/BLOG/ @PAOLOPIA
    31. 31. thank you. SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×