I need to get list of items/pages and all its associated contents in a workflow using the powershell script. Is there any possibility to achieve the same?
1 Answer
You can use something really simple if you not have many items :
$itemsWithMatchingDefaultWorkflow = Get-Item -Path master: -Query "/sitecore/media library/*[@__Workflow='{0729C93B-888A-4765-8486-8F1AE86A3894}']"
foreach ($item in $itemsWithMatchingDefaultWorkflow)
{
Write-Host " -" $item.ID $item.Paths.FullPath
}
If you have huge amount of items I suggest to query in the search indexes.
-
I was able to get parent items, now how do I get the children items within the given path in query? Consider I am looping through "sitecore/content/My home" Jan 19, 2022 at 7:48
-
$itemsWithMatchingDefaultWorkflow = Get-Item -Path master: -Query "/sitecore/content/My home//*[@__Workflow='{0729C93B-888A-4765-8486-8F1AE86A3894}']" try in this way. Jan 19, 2022 at 7:50
-
and have a look here to understand how Sitecore query is working: doc.sitecore.com/xp/en/SdnArchive/Reference/… Jan 19, 2022 at 7:50