0

I am using Sitecore Powershell Module, to select list of pages that can be later on translated and created new item.

I am using this block of code

@{
        Name = "listOfPages"
        Title = "Select pages you wish to copy on other languages"
        Editor = "Treelist"
        Source = "DataSource=/sitecore/content/XXXX/Home&DatabaseName=master"
        Tooltip = "Select one or more page from list."
    },
1
  • If you have any conditions for filtering then you can use the Get-ChildItem commandlet to get all the items and filter them using Where-Object commandlet May 20 at 14:05

1 Answer 1

1

To get the result of all the selected pages in TreeList, you need to write your code something like this.

$props = @{
    Parameters = @(
        @{Name="listOfPages"; Title="Select Language"; Options=$languageTypes; Tooltip="Select one or more page from list"; Editor="Treelist"; Source = "DataSource=/sitecore/content/DC Decorio/DecorioLocal/Home&DatabaseName=master"} 
    )
    Title = "Select pages you wish to copy on other languages"
    Description = "Choose the criteria."
    Width = 550
    Height = 300
    ShowHints = $true    
}

$result = Read-Variable @props
$listOfPages | Select-Object DisplayName, FullPath

This will give you the list of pages in output. You can use the variable $listOfPages and create a loop and write your code.

Create a loop like this

$listOfPages | ForEach-Object {
    Write-Host $_.DisplayName
}

Hope this helps.

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.