How to get custom reusable workflow feature in CSOM?

Highlighted
Occasional Contributor

Hello,

 

I have created a custom reusable workflow in SharePoint Designer. I am facing an issue after deployment of workflow. I have to activate the workflow feature with CSOM but I am not able to get that feature with CSOM code. I have tried code but this code is not showing that custom workflow feature id. I have tried on web & site level also :

 

public static void GetAllWebFeatures(ClientContext ctx, Web web)
{

try
{
var webFeatures = web.Features;
ctx.Load(webFeatures, fcol => fcol.Include(f => f.DisplayName, f => f.DefinitionId));
ctx.ExecuteQuery();
foreach (var f in webFeatures)
{
Console.WriteLine(f.DisplayName);
}
}
catch(Exception ex)
{
Helper.WriteException("Error in GetAllFeatures", ex);
}


}

2 Replies
Highlighted
Instead of using standard CSOM to deal with SharePoint features, use PnP cmdlets...they will make your life easier
Highlighted

Thanks for your reply. But we have to enable that feature with CSOM.