I'm trying to write a simple Powershell script that finds all General Link
fields and outputs the value of their Source
field.
$fields = Get-ChildItem -Path "master://sitecore/templates/user defined" -Recurse | Where-Object { $_.TemplateName -eq "Template field" -and $_.Type -eq "General Link" }
foreach ($field in $fields) {
Write-Host "Name: $($field.Name)"
Write-Host "Source: $($field.Source)"
Write-Host
}
Whenever I run it, however, the value from the Source
field is empty for all returned items.
I've confirmed that it is populated in at least some of the cases, but it never shows up in the report. I've tried several variations to get the value, too:
$fields | Show-ListView -property `
@{ Name="Path"; Expression={$_.Paths.Path} },
@{ Name="Source"; Expression={$_.Source} },
@{ Name="Source With Quotes"; Expression={$_."Source"} }
Versions
- Sitecore version: 8.1 Update 3
- Sitecore PowerShell Extensions version: 5.0.0.42513