SharePoint 2010 Workflow and CSOM on SharePoint Online

Copper Contributor

Hey SharePoint peeps:
We have problem with SharePoint 2010 Workflow and CSOM on SharePoint Online instance.

Our goal is to provision Site/SiteCollection using CSOM/PnP, with Publishing Infrastructure feature enabled.
We are able to provision lists, set variations etc., however the problem is with “Publishing Approval” workflow.
I just can’t find the way to assign it’s the list.
Unfortunately it’s SP2010 workflow, so CSOM seems to be completely helpless with that.
As Publishing Infrastructure is enabled, we are unable to save the site as WSP template.
Saving list with assigned workflow works only across that single site (on others it creates right list with assigned CT, but without workflow).
We even tried to “fake” HTTP calls to Sharepoint, to emulate clicking on the form,
but in this case, as we have two steps to set workflow, it failed as well.

Is there any way to assign Publishing Approval workflow using CSOM? Thanks in advance.

1 Reply

Hi Pawel,

The hack we use in our stack in cases such as these is screen scrape using JavaScript as the final step. It's not ideal because it requires someone with permission to actually access the deployment target post provisioning. 

The way it works is that the engine injects a custom action that does the work. If it succeeds it deletes itself. If you find a better way, please let me know.