4

I have the following script to output to a table certain fields of a selection of items

Get-Item -Path "master:" -Query "fast:/sitecore/content/Home//*[@@templateid='{BAC0709D-5606-4A86-AF67-35F1448FDBE6}']" | Show-ListView -Property ID, Name, DisplayName, "Page Title"

Obviously I just reference by name any fields I want to output, but what if I want to output a property, say item.Paths.FullPath? How would I achieve that?

4

This is explained here: https://doc.sitecorepowershell.com/appendix/commands/Show-ListView.html#example-2

You can use @{Label="Path"; Expression={$_.Paths.FullPath} } in the list of properties where you specify a label for the column and reference the item using Expression={$_.Paths.FullPath}

The final query becomes

Get-Item -Path "master:" -Query "fast:/sitecore/content/Home//*[@@templateid='{BAC0709D-5606-4A86-AF67-35F1448FDBE6}']" | Show-ListView -Property ID, Name, DisplayName, "Page Title", @{Label="Path"; Expression={$_.Paths.FullPath} }

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.