0

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 1

2

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.

3
  • 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 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 at 7:50
  • and have a look here to understand how Sitecore query is working: doc.sitecore.com/xp/en/SdnArchive/Reference/… Jan 19 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.