Answered by:
SharePoint 2010 Workflow and CSOM on SharePoint Online

Question
-
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.Tuesday, July 19, 2016 2:10 PM
Answers
-
Hi Pawel Bojkowski,
From your description, my understanding is that you want to associate a 2010 workflow with SharePoint online list.
You can attach the workflow to the list using WorkflowAssociations.Add method.
Refer to the code example in the link below:
And a thread with similar question:
Best Regards,
Linda Zhang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Victoria Xia Tuesday, July 26, 2016 2:10 AM
- Marked as answer by Victoria Xia Tuesday, August 9, 2016 1:38 AM
Wednesday, July 20, 2016 9:10 AM
All replies
-
Refer this:
https://msdn.microsoft.com/en-us/library/office/dn481315.aspx?f=255&MSPPError=-2147217396
Thanks, Rahul Rashu
Tuesday, July 19, 2016 5:54 PM -
Hi Pawel Bojkowski,
From your description, my understanding is that you want to associate a 2010 workflow with SharePoint online list.
You can attach the workflow to the list using WorkflowAssociations.Add method.
Refer to the code example in the link below:
And a thread with similar question:
Best Regards,
Linda Zhang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Victoria Xia Tuesday, July 26, 2016 2:10 AM
- Marked as answer by Victoria Xia Tuesday, August 9, 2016 1:38 AM
Wednesday, July 20, 2016 9:10 AM