Unable to start/stop workflow instances associated with a List Item

Nirenjana Raghupathy 26 Reputation points
2024-05-30T01:15:27.9533333+00:00

Hi All,

I'm trying to stop workflow instances attached to a specific List Item In a SharePoint List. But I notice the workflow subscription command always returns null, due to which Stop-PnPWorkflowInstance fails.

#Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber

#Install-Module -Name Microsoft.PowerApps.Administration.PowerShell

#connect with PROD Azure environment

#Connect-AzureAD -TenantId

#Add-PowerAppsAccount

$environments = Get-FlowEnvironment #This is to get all available Environment in our Power Automte Tenant

foreach($environ in $environments.EnvironmentName) #Cycle to all Environments

{

$flows = Get-Flow –EnvironmentName $environ 

foreach ($flow in $flows) #Loop to each PowerAutomate workflow Available

{

    if($flow.DisplayName -eq "wfName")

    {  

        $WFSubscription = Get-PnPWorkflowSubscription -List "List title" -Name "wfName"

        $WFSubscriptionName = $WFSubscription.Name

        Stop-PnPWorkflowInstance -ListItem 9701 -Subscription $WFSubscription

}

}
```}

Please let me know what is incorrect here?
Microsoft 365 and Office | SharePoint | For business | Windows
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,861 Reputation points Microsoft External Staff
    2024-05-30T09:52:19.9833333+00:00

    Power Automate is currently not supported in the Q&A forum.

    Please start a new discussion via the Power Automate Community so that you can get dedicated support on this issue.

    Thank you for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.