SharePoint 2013 Workflow with Visual Studio 2012

Today I have been working on a project that required a workflow in order to keep track of a status. Because we were working with SharePoint 2013 I thought lets build a SharePoint 2013 Workflow.

First of all when you would like to begin using SharePoint 2013 Workflow you have to install some services. When using the Web Platform Installer it is quit easy. When you still need to install SharePoint 2013 workflow following the below article from Microsoft:

When you want to start with developing SharePoint 2013 workflows you will also have to install a Extension for Visual Studio:

  • Workflow Manager Tools 1.0 for Visual Studio 2012

When creating my first workflow for Visual Studio 2012 I noticed that I was missing a .cs file so I started to read some articles on MSDN:

The following line got my attention.

“As with previous versions, Microsoft SharePoint 2013 provides two primary workflow development environments for authoring workflows: Microsoft SharePoint Designer and Microsoft Visual Studio. However, what differs from previous versions is that using Visual Studio no longer provides a code-based authoring strategy. Instead, both SharePoint Designer and Visual Studio provide a fully declarative, no-code authoring environment regardless of the development tool you select.”

Basically this will mean you can only create your workflow declarative. When you need to write custom code you will have to build a custom action:

When I was creating my first workflow the second thing I noticed was that there are a lot of actions you use and that it is quite easy to extend:

image

All together I think this new approach is very powerful and does also mean you will be able to create APP workflow.

Deploying my first workflow directly resulted in a error when activating the feature:

Server Error in ‘/’ Application.
——————————————————————————–

Microsoft.SharePoint.SPException: App Management Shared Service Proxy is not installed.
   at Microsoft.SharePoint.AppRegistration.GetProxy(SPServiceContext serviceContext)
   at Microsoft.SharePoint.AppRegistration.AddOrUpdateAppNoPermissionCheck(SPAppPrincipalInfo appInfo)

You will have to create a App Management Service Application if you want to run SharePoint 2013 workflow and off course also start the “App Management Service“. Besides that the “Microsoft SharePoint Foundation Subscription Settings Service” should be started and you also have to make the Service Application by using PowerShell.

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$account = Get-SPManagedAccount devdevservice
$appPool = New-SPServiceApplicationPool -Name SubscriptionServiceAppPool -Account $account 
$serviceApp = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -name "Subscription Settings Service Application" -DatabaseName "SP2013_DEV_SubscriptionSettingsDB" 
$serviceAppProxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $serviceApp

One other thing I noticed is that the workflow feature will have to be a Web scoped features. You should keep this in mind when designing your solutions.

Related Posts

Forcing a Device Channel Device channels are a way of using different master pages for different devices. MSDN describes the functionality as followed:   “Browsing ...
Offline Installation SharePoint 2013 In many situation you would like to do a offline installation of SharePoint 2013 or you are required to do a offline installation because you do not h...
User automatically removed from SharePoint Group During my current project we received an access request from a user. We did what we normally do, we checked the request and added the user in the appr...
Unable to start User Profile Synchronization Service A few days ago I wrote a post about loading modules in PowerShell by default: “Load modules by default when opening PowerShell”. Today we had to setup...
Filtering SharePoint Search Results by Content Source Working for one my projects we were looking for a solution to only retrieve search results for a specific Content Source. In our scenario we had a Ext...
PowerShell Scripts During my current project we are using a lot of PowerShell scripts to administrate the environment and make development easier for us. In this post...

One comment

  • This is real technical blog which talks about SharePoint 2013 work flow. Outstanding information is passed to the entire user in this blog.

Leave a Reply

Your email address will not be published. Required fields are marked *