SOLVED

Get-PnPProvisioningTemplate and workflows

%3CLINGO-SUB%20id%3D%22lingo-sub-41408%22%20slang%3D%22en-US%22%3EGet-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41408%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20my%20today's%20SharePoint%20situation%20I%20need%20to%20replicate%20an%20website%20from%20a%20dev%20environment%20into%20another%20dev%20environment%20(without%20content%2C%20only%20structures).%20I%20have%20been%20looking%20to%20the%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3EGet-PnPProvisioningTemplate%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3Ecmdlet%20of%20the%20SharePoint%20PnP%20Powershell.%20However%20it%20seems%20that%20the%20generated%20template%20doesn't%20include%20existing%20workflows%20associated%20to%20the%20current%20lists%2C%20not%20even%20in%20the%20case%20of%20OOB%20workflows%20like%20%22Approval%22.%20Is%20there%20a%20workaround%20for%20this%20using%20PnP%20or%20other%20existing%20tools%3F%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-99944%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-99944%22%20slang%3D%22en-US%22%3EHi%20Amit%2C%3CBR%20%2F%3EMaybe%20I%20wasn't%20clear.%20My%20solution%20was%20to%20simply%20create%20the%20same%20WF%204%20times%20in%20SharePoint%20designer%20for%20each%20of%20the%204%20sites%20I%20had.%20Unfortunately%20I%20didn't%20find%20anyway%20to%20do%20this%20better.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-99943%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-99943%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20share%20the%20manual%20steps%20that%20were%20followed%20by%20you%3F%20To%20generate%20workflow%20definition%20for%20SP%202010%20workflows%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-86986%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-86986%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Aldrin%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnfurtunately%20I%20ended%20up%20doing%20this%20manually.%20If%20you%20find%20an%20alternative%20please%20share%20it%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20luck%2C%3C%2FP%3E%3CP%3EAbel%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-86971%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-86971%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Abel%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20having%20the%20same%20problem%20with%20SP2010%20workflows%20and%20I'm%20curious%20how%20you%20got%20around%20this%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42655%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42655%22%20slang%3D%22en-US%22%3ECan%20you%20please%20point%20me%20to%20some%20resources%20so%20I%20can%20read%20more%20about%20the%20%22theoretically%20exporting%20SP2010%20workflows%20could%20be%20done%20in%20some%20level%22%20part%3F%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20to%20create%204%20site%20collections%20with%20the%20same%20workflow%20and%20so%20far%20it%20seems%20that%20the%20only%20way%20to%20do%20it%20is%20to%20replicate%20the%20wf%20manually%20all%204%20times.%20The%20workflow%20is%20quite%20big%20with%20about%2020%20activities%20including%20custom%20tasks.%20For%20what%20is%20worth%20I%20am%20using%20SP%202013%20%2F%20SP%20Designer%202013%20%2F%20WF%202010.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42648%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42648%22%20slang%3D%22en-US%22%3E%3CP%3EPnP%20provisioning%20engine%20export%20does%20not%20support%20unfortunately%20SP2010%20workflows.%202013's%20are%20supported.%20SP2010%20workflows%20are%20using%20slightly%20different%20API%20surface%20and%20file%20format.%20Even%20though%20theoretically%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eexporting%20SP2010%20workflows%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecould%20be%20done%20in%20some%20level%2C%20exporting%20any%20custom%20workflows%20with%20code%20behinds%20would%20not%20work%20and%20experience%26nbsp%3Binadequate.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42617%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42617%22%20slang%3D%22en-US%22%3E%3CP%3Estrange%20maybe%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369%22%20target%3D%22_blank%22%3E%40Vesa%20Juvonen%3C%2FA%3E%26nbsp%3Bcan%20take%20%26nbsp%3Ba%20look%20at%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42518%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42518%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Paul%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20keep%20struggling%20with%20the%20provisioning%20templates%20for%20sites%20containing%202010%20Workflows.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThese%20are%20the%20commands%20I%20have%20tried%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-PnPProvisioningTemplate%20-Out%20%24templateFolder%5Cfull.pnp%3C%2FP%3E%3CP%3EGet-PnPProvisioningTemplate%20-Out%20%24templateFolder%5Cwfl.pnp%20-Handlers%20Workflows%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20both%20cases%20when%20I%20inspect%20the%20zip%20file%20I%20find%20this%20(no%20xaml%20files%20whatsoever)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41858%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41858%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20will%20work%20with%20both%20as%202010%20and%202013%20deliver%20xaml.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41644%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41644%22%20slang%3D%22en-US%22%3EIt%20helps%20indeed.%20However%20I%20am%20missing%20the%20fact%20of%20whether%20this%20is%20only%20possible%20with%202013%20worflows%20or%20also%20with%202010%20workflows%20as%20well%3F%20Because%20in%20my%20current%20scenario%20I%20need%20this%20to%20work%20with%20the%20latter%20ones.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41643%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41643%22%20slang%3D%22en-US%22%3E%3CP%3EMaybe%20my%20blog%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsharepoint-specialist.nu%2Fhow-to-implement-sharepoint-workflow-with-custom-forms-in-pnp-template-3a515cbfd88%23.jef62njbw%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint-specialist.nu%2Fhow-to-implement-sharepoint-workflow-with-custom-forms-in-pnp-template-3a515cbfd88%23.jef62njbw%3C%2FA%3E%20will%20help%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41621%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41621%22%20slang%3D%22en-US%22%3EIt's%20weird%2C%20cos%20there's%20no%20special%20Flag%20to%20that%2C%20and%20in%20theory%2C%20should%20place%20all%20the%20extracted%20Files%20in%20the%20same%20path%20specified%20in%20the%20-Out%20flag.%20Are%20you%20using%20a%20full%20path%20in%20the%20-Out%20flag%3F%20(kind%20of%20c%3A%2Ftemp%2Ftemplate.xml)%3CBR%20%2F%3EAnyway%2C%20if%20works%20fine%20with%20the%20.pnp%20extension%2C%20we're%20good%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41614%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41614%22%20slang%3D%22en-US%22%3EYes%20last%20version%20and%20everything.%20I%20just%20notice%20that%20workflow%20info%20is%20not%20generated%20when%20using%20xml%20format%2C%20at%20least%20not%20without%20any%20aditional%20flags.%20I%20exported%20the%20template%20as%20pnp%20and%20solved%20the%20issue.%20Thanks!%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41613%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41613%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20your%20time.%20I%20found%20the%20issue.%20I%20was%20generating%20xml%20templates.%20It%20turns%20out%20that%20wf%20information%20is%20included%20as%20a%20separated%20xaml%20file%2C%20so%20in%20order%20to%20get%20this%20you%20need%20to%20export%20to%20the%20open%20xml%20(pnp)%20file%20format.%20Perhaps%20there%20is%20some%20flag%20to%20generate%20those%20files%20and%20still%20use%20the%20pure%20xml%20format%20for%20the%20template%20(kind%20of%20what%20you%20do%20with%20the%20PersistBrandingFiles%20flag.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41590%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41590%22%20slang%3D%22en-US%22%3EAccording%20to%20PnP-Core%20code%2C%20the%20ObjectWorkflow%20ObjectHandler%20should%20extract%20Workflows%20lists%2C%20so%2C%20as%20Paul%20said%2C%20did%20you%20try%20with%20latest%20version%3F%3CBR%20%2F%3E%3CBR%20%2F%3EAlso%2C%20you%20can%20enable%20Debug%20before%20running%20the%20Get-PnPProvisioning%20template%3A%3CBR%20%2F%3ESet-SPOTraceLog%20-On%20-Level%20Debug%3CBR%20%2F%3Eand%20let%20us%20know%20if%20there's%20any%20error.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41571%22%20slang%3D%22en-US%22%3ERe%3A%20Get-PnPProvisioningTemplate%20and%20workflows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41571%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Abel%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehave%20you%20been%20using%20the%20latest%20version%20of%20PNP%3F%20what%20i%20get%20normally%20is%20the%20template%20and%20the%20xaml%20files.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ekr%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPaul%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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
Highlighted

Hi Abel,

 

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

 

kr,

 

Paul

Highlighted
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.
Highlighted

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.

Highlighted
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!
Highlighted
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 :)
Highlighted
Highlighted
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.
Highlighted

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

Highlighted

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):

 

Highlighted

strange maybe @Vesa Juvonen can take  a look at it.

Highlighted

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. 

Highlighted
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!
Highlighted

Hi Abel,

 

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

 

Thanks!

Highlighted

Hi Aldrin,

 

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

 

Good luck,

Abel

 

Highlighted

Hi,

 

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

Highlighted
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.