$ver = $host | select version
if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$TargetWeb = "http://sharepoint/"
$TargetLibrary = "Library"
$Filename = 133 # the item ID
$MyWeb = Get-SPWeb $TargetWeb
$list = $MyWeb.Lists[$TargetLibrary]
$item = $list.GetItemById($Filename)
foreach ($wf in $item.Workflows) {
#Cancel Workflows
[Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($wf);
}
WRITE-HOST "Discarded workflows"
1 comment:
Sorry to post a comment here, but I have a question about one of your old posts and it wouldn't let me comment directly on it and I didn't see any other way to contact you. The question is regarding your post titled "InfoPath 2010: Populating a dropdown with SharePoint Metadata Termstore" I am attempting to do the same thing with InfoPath 2013 and SharePoint 2016, but cannot make it work... Any help would be appreciated. If there is a better way to contact you please let me know.
Post a Comment