Created
March 11, 2014 20:46
-
-
Save rheid/9494647 to your computer and use it in GitHub Desktop.
Start a SharePoint 2013 Workflow with CSOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The way workflow get triggered from code behind is different in SharePoint 2013 | |
//Instantiate Workflow Manager | |
var wsm = new Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager(web); | |
//Get Workflow Instane ID | |
var subscription = wsm.GetWorkflowSubscriptionService().GetSubscription(new Guid("{2DC2893B-DEC0-433A-BB34-8DC0CD9CC8FC}")); | |
//Start Workflow | |
var wfi = wsm.GetWorkflowInstanceService(); | |
var payload = new Dictionary<string, object>(); | |
payload.Add("ItemId", itemToUpdate.ID); | |
payload.Add("WorkflowStart", "StartWorkflow"); | |
wfi.StartWorkflowOnListItem(subscription, itemToUpdate.ID, payload); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment