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"Visva Kiruthika Muthuraj– Visva Kiruthika Muthuraj2022-01-19 07:48:01 +00:00Commented 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.Vlad Iobagiu– Vlad Iobagiu2022-01-19 07:50:32 +00:00Commented 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/…Vlad Iobagiu– Vlad Iobagiu2022-01-19 07:50:50 +00:00Commented Jan 19, 2022 at 7:50