SOLVED

Get-PnPProvisioningTemplate and workflows

Copper Contributor

In my today's SharePoint situation I need to replicate an website from a dev environment into another dev environment (without content, only structures). I have been looking to the

 

Get-PnPProvisioningTemplate

cmdlet of the SharePoint PnP Powershell. However it seems that the generated template doesn't include existing workflows associated to the current lists, not even in the case of OOB workflows like "Approval". Is there a workaround for this using PnP or other existing tools?

Thanks in advance

16 Replies

Hi Abel,

 

have you been using the latest version of PNP? what i get normally is the template and the xaml files.

 

kr,

 

Paul

best response confirmed by Abel García Celestrín (Copper Contributor)
Solution
According to PnP-Core code, the ObjectWorkflow ObjectHandler should extract Workflows lists, so, as Paul said, did you try with latest version?

Also, you can enable Debug before running the Get-PnPProvisioning template:
Set-SPOTraceLog -On -Level Debug
and let us know if there's any error.

Thanks for your time. I found the issue. I was generating xml templates. It turns out that wf information is included as a separated xaml file, so in order to get this you need to export to the open xml (pnp) file format. Perhaps there is some flag to generate those files and still use the pure xml format for the template (kind of what you do with the PersistBrandingFiles flag.

Yes last version and everything. I just notice that workflow info is not generated when using xml format, at least not without any aditional flags. I exported the template as pnp and solved the issue. Thanks!
It's weird, cos there's no special Flag to that, and in theory, should place all the extracted Files in the same path specified in the -Out flag. Are you using a full path in the -Out flag? (kind of c:/temp/template.xml)
Anyway, if works fine with the .pnp extension, we're good 🙂
It helps indeed. However I am missing the fact of whether this is only possible with 2013 worflows or also with 2010 workflows as well? Because in my current scenario I need this to work with the latter ones.

It will work with both as 2010 and 2013 deliver xaml.

Hi Paul, 

 

I keep struggling with the provisioning templates for sites containing 2010 Workflows.

 

These are the commands I have tried:

 

Get-PnPProvisioningTemplate -Out $templateFolder\full.pnp

Get-PnPProvisioningTemplate -Out $templateFolder\wfl.pnp -Handlers Workflows

 

In both cases when I inspect the zip file I find this (no xaml files whatsoever):

 

strange maybe @VesaJuvonen can take  a look at it.

PnP provisioning engine export does not support unfortunately SP2010 workflows. 2013's are supported. SP2010 workflows are using slightly different API surface and file format. Even though theoretically exporting SP2010 workflows could be done in some level, exporting any custom workflows with code behinds would not work and experience inadequate. 

Can you please point me to some resources so I can read more about the "theoretically exporting SP2010 workflows could be done in some level" part?

I have to create 4 site collections with the same workflow and so far it seems that the only way to do it is to replicate the wf manually all 4 times. The workflow is quite big with about 20 activities including custom tasks. For what is worth I am using SP 2013 / SP Designer 2013 / WF 2010.

Thanks!

Hi Abel,

 

I'm having the same problem with SP2010 workflows and I'm curious how you got around this problem.

 

Thanks!

Hi Aldrin,

 

Unfurtunately I ended up doing this manually. If you find an alternative please share it here.

 

Good luck,

Abel

 

Hi,

 

Can you share the manual steps that were followed by you? To generate workflow definition for SP 2010 workflows

Hi Amit,
Maybe I wasn't clear. My solution was to simply create the same WF 4 times in SharePoint designer for each of the 4 sites I had. Unfortunately I didn't find anyway to do this better.
1 best response

Accepted Solutions
best response confirmed by Abel García Celestrín (Copper Contributor)
Solution
According to PnP-Core code, the ObjectWorkflow ObjectHandler should extract Workflows lists, so, as Paul said, did you try with latest version?

Also, you can enable Debug before running the Get-PnPProvisioning template:
Set-SPOTraceLog -On -Level Debug
and let us know if there's any error.

View solution in original post