0

I am trying to see if I can traverse through every node in a bucket and get all its items using PSE. All I am able to get is only the root bucket folder.

I tried all the below options with no luck.

 $allItems = Get-ChildItem  -Recurse master: -Query "/sitecore/system/Modules/Redirect Module/Redirects/Sites/Url//*[@@templatename ='Redirect Url']" -language en

  $allItems = Get-ChildItem -Path  -Recurse master: -ID "{A6BA7A2F-3C77-4655-B022-CC718BDB0B6E}"

  $everythingUnderRedirects = Get-Item master: -Query "/sitecore/system/Modules/Redirect Module/Redirects/Sites/Url//*[@@templatename ='Redirect Url']" -Language en

It returns me only the root bucket folder (the year folder 2016, 2017, etc)

  • What's the data structure? It's not entirely clear which items you want to return. I can see you using both Get-Item and Get-ChildItem with the same query. Your Powershell commands are also a little strange, some places you give a -Path parameter without declaring it, and in the 2nd example you declare it but follow it with -Recurse before you give it a value. – James Walford Jul 5 at 13:22
  • @JamesWalfordas as i said in my question.... i tried 3 different queries.. – Night Monger Jul 5 at 13:33
2

Try to use Find-Item command-let instead of Get-Item

$criteria = @(
  @{ Filter = "Equals"; Field = "_templatename"; Value = "Redirect Url"; }, 
  @{ Filter = "DescendantOf"; Value = (Get-Item "master:/sitecore/system/Modules/Redirect Module/Redirects/Sites/Url/"); }
)

$props = @{
    Index = "sitecore_master_index"
    Criteria = $criteria
}

$allItems = Find-Item @props
  • thank you.. that did it.. – Night Monger Jul 5 at 13:45

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.