工作流订阅中的工作流定义 [英] Workflow Definition from Workflow Subscription
问题描述
使用PNP工具
我受命编写一个PowerShell脚本,该脚本将更新我们专用环境中的工作流程(不是Tenant,因此请不要为他们的任何工具提供建议).我可以获取网络,列表并查看与哪些工作流程订阅相关联 用它.但是我无法获取工作流定义(既不通过Web对象也不通过列表对象).有什么想法/建议吗?我需要开箱即用的所有工作流程和SPD.
I have been tasked to write a PowerShell script that will update the workflows in our dedicated environment (not Tenant, so please don't advise about any of their tools). I am able to get the web, the lists and see what workflow subscriptions are associated with it. However I cannot get the workflow Definition (neither via the web object nor list object). Any thoughts/suggestions? I need all workflows, both out of the box and SPD.
foreach($spsite in $SPSiteCollects) {
Connect-PnPOnline $spsite -CurrentCredentials
$site = Get-PnPSite
$web = Get-PnPWeb
Write-Host $web.Title -ForegroundColor White -BackgroundColor red
$allLists = Get-PnPList -Web $web
if($allLists.Count -gt 0){
foreach($list in $allLists) {
$allWFSub = Get-PnPWorkflowSubscription -List $list
if($allWFSub.Count -gt 0) {
foreach($wfsub in $allWFSub) {
Write-Host " " $list.Title -ForegroundColor green
write-host " " $wfsub.Name -ForegroundColor Cyan
$wfDef = Get-PnPWorkflowDefinition -Name $wfsub.Name
$wfDef #(RETURNS NOTHING IN MOST INSTANCES-NOT ALL)
}
}
}
}
}
-谢谢.尊敬的Janette M. Ricker
- Thank you. Respectfully, Janette M. Ricker
推荐答案
嗨Janette,
Hi Janette,
以下是一个PowerShell脚本,它将从网站集中获取所有工作流程定义,以供您参考:
Here is a PowerShell script will get all workflow definitions from in the site collection for your reference:
siteurl ="http://sp/sites/dev"
siteurl="http://sp/sites/dev"
site =新对象Microsoft .SharePoint.SPSite(
site=new-object Microsoft.SharePoint.SPSite(
这篇关于工作流订阅中的工作流定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!