I have got created a list workflow in SharePoint Designer for a SharePoint Online Site Collection. Now I want to export this workflow and import it automatically to a new site collection during / after provisioning.

I found a PnP-PowerShell Cmd to export and import workflows. The export works fine, but when I want to import the workflow, a exception is shown.

PowerShell Code (QAZI MOBEEN - Export/Import SharePoint Designer Workflows using PowerShell):

Connect-PnPOnline -Url $Url -Credentials $cred

Write-Host " "
Write-Host "Connected successfully to: $($Url)" -ForegroundColor Yellow

$ctx = Get-PnPContext
$parentContentTypeId = $null

$wf = Get-PnPWorkflowDefinition -Name $WFDefinitionName

if ($wf -eq $null)
    # Load workflow definition
    Publish-WorkflowDefinition (Get-PnPContext) $FilePath $WFDefinitionName

    Add-PnPWorkflowSubscription -Name $WFDefinitionName -DefinitionName $WFDefinitionName -List "Dokumente" -HistoryListName "Workflow History" -TaskListName "Aufgaben" -StartOnCreated
    Write-Host "Workflow definition $($WFDefinitionName) already exists.." -ForegroundColor Yellow

The error code is the following:

Add-PnPWorkflowSubscription : Der Objektverweis wurde nicht auf eine
Objektinstanz festgelegt.
In C:\Users\xxx\source\Workspaces\Dev\src\AddIns\Import.ps1:33 Zeichen:5
+     Add-PnPWorkflowSubscription -Name $WFDefinitionName -DefinitionNa ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Add-PnPWorkflowSubscription], N
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Work

Because of this interruption the workflow is published as "reusable" workflow instead of list workflow.

I do not get the wrong params in this line:

Add-PnPWorkflowSubscription -Name $WFDefinitionName -DefinitionName $WFDefinitionName -List "Dokumente" -HistoryListName "Workflow History" -TaskListName "Aufgaben" -StartOnCreated

Do you have any ideas to solve this issue?

2 Answers 2


You could export and import the workflow by SharePoint designer like the picture below.

enter image description here

For more detailed information, refer to the article below.

Export-Import SharePoint Designer Workflow.

  • Thanks for your reply and the idea to ex-/import wirkflows manual. But I need to import the workflow automatically during / after the provisioning of site collections. Sep 22, 2018 at 11:25

I solved my problem.

If someone gets the same issue, you have to look in your xaml-file and replace GUID from your list(s). Afterwards everything works and the workflow will be a list workflow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.