Skip to main content

I know you can find the ID using this:

How to find the WorkflowId 

but how can I find this with either script or code?

 

I'm currently exporting and importing workflows with the rest api. but I'm having a hard time publishing them because I cant find their ID.

 

/Erik

Perhaps this is useful >>> https://community.nintex.com/message/22844?commentID=22844#comment-22844 


Kinda old post, but hope it helps someone else.
Open the workflow and find the workflow ID on the URL.

get the workflow ID, you must query the workflow subscription service

You can get all the subsciption of your site with this (using POST) : /_api/SP.WorkflowServices.WorkflowSubscriptionService.Current/EnumerateSubscriptions()

(first, you must be authenticated to your sharepoint site, and pass your request digest in the header)

 

The workflow ID will be in the property "DefinitionId"

If you need to get it in CSOM, let me know, I can help you


@nico any chance you can show this with some screenshots or example code?


@eharris04  Of course.

This is an exemple with PostMan Tools (to get workflow definition of a site using SharePoint REST API)

(I have just hide the URL of my site in this screen shot)

 

In CSOM (this is a very simple exemple of code, the var clientContext is object of type Microsoft.SharePoint.Client.ClientContext, and the currentWeb is object of type Microsoft.SharePoint.Client.Web

using Microsoft.SharePoint.Client.WorkflowServices;



/****/



WorkflowServicesManager _WorkflowManager = new WorkflowServicesManager(clientContext, currentWeb);

clientContext.Load(_WorkflowManager);

clientContext.ExecuteQuery();

var deployService = _WorkflowManager.GetWorkflowDeploymentService();

var publishedWorkflowDefinitions = deployService.EnumerateDefinitions(true);

clientContext.Load(publishedWorkflowDefinitions);

clientContext.ExecuteQuery();

foreach (var wfDefinition in publishedWorkflowDefinitions)

{

Console.WriteLine(wfDefinition.DisplayName + " : " + wfDefinition.Id);

}

 


Reply