Skip to main content
2 of 4
added 227 characters in body
ckhanna
  • 3.7k
  • 1
  • 1
  • 12

You can use Get-ItemField function to get all item fields and loop through them as below to read them.

$item = Get-Item -Path "master:" -ID "{{Item_ID}}"
$fields = $item | Get-ItemField -ReturnType Field
foreach($field in $fields){
  Write-Host "Field Name: $($field.Name)"
  Write-Host "Field Value: $($item.Fields[$field.Name].Value)" 
}

This will return all the fields on the item which are not standard fields. In case you would like to fetch standard fields as well you can add -IncludeStandardFields flag to Get-ItemField function.

Note: In order to make sure $item.Fields returns all the fields, you will need to call $item.Fields.ReadAll() function before reading item fields as below.

$item.Fields.ReadAll()
$fields = $item.Fields

Hope this helps!!!

ckhanna
  • 3.7k
  • 1
  • 1
  • 12