1

I have here a Read-Variable command that will make you select any content folder.

$root= Get-Item master:\content\home

$selectFolder= Read-Variable -Parameters
    @{ Name = "root"; Title="Start Item"; Root="/sitecore/content/"}
    -Description "This Dialog shows less editors, it doesn’t need tabs as there is less of the edited variables"
    -Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 -OkButtonName "Proceed" -CancelButtonName "Abort"

Now, I want to get the descendants of the folder selected above that are based on this template id {FF24F59C-E4B4-4130-A119-036A02B3543B} using fast query.

1 Answer 1

2

Look at the script below.

  1. First initial value for $selectFolder is set.
  2. Then Read-Variable is called and Name = "selectFolder" path says that whatever is selected in the popup should be set back to $selectFolder variable.
  3. Then the query is executed to search in master database with full item path and template of your choice.
$selectFolder = Get-Item master:\content\home

$result = Read-Variable -Parameters `
    @{ Name = "selectFolder"; Title="Start Item"; Root="/sitecore/content/"} `
    -Description "This Dialog shows less editors, it doesn’t need tabs as there is less of the edited variables" `
    -Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 -OkButtonName "Proceed" -CancelButtonName "Abort"

$queryResult = Get-Item Master: -Query ($selectFolder.Paths.FullPath + "//*[@@templateid='{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}']")
$queryResult
2

Your Answer

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

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