1

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

3

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" Commented 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. Commented 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/… Commented Jan 19, 2022 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.