Using the Workflow Client API with Windows Powershell

The following example demonstrates how to start a K2 Process using a Windows Powershell script.

#
#Using Workflow Client API with Windows Powershell
#

[System.Console]::WriteLine("Sample powershell script to start a K2 process")
Add-Type -AssemblyName ("SourceCode.Workflow.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d")
$conn = New-Object -TypeName SourceCode.Workflow.Client.Connection
#a simple connection
$conn.Open("localhost")
$pi = $conn.CreateProcessInstance("[Folder]\[ProcessName]")
$pi.Folio = "[Folio value]"
$conn.StartProcessInstance($pi)
$conn.Close