1

How to tell if the item language is the fallback language or the regular language version using a PowerShell script

1

3 Answers 3

2

You can check item is a fallback item, through reading IsFallback property available on the item as below.

$item = Get-Item -Path "master:" -ID "{{Item_ID}}"
Write-Host $item.IsFallback

This will return true if the item is a fallback item.

Hope this helps!!!

2

Language fallback can be checked by the Item.IsFallback property, which returns true if the item is a fallback item.

I didn't test it in Powershell but you can try it by the IsFallback property.

0

Thank you for your posts. I tried many different ways. But many cases did not work. The following steps worked.

# Iterate over all languages of the item
foreach ($language in $item.Languages) 
{
   # Get the item in the current language
   $itemInLanguage = Get-Item -Path $item.Paths.Path -Language $language

   # Check if count greater than 0 or not
   if ($itemInLanguage.Count -gt 0) {
       Write-Host "version found in language: $language"
    } else {
       Write-Host "no version found or fallback version in language: $language"
    }
 }

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.