Finding Sitecore Items Without a Language Version

A few days ago,  I need to find items which do not have any version in any lanuage defined in system. Luckily, a blog post on jockstothecore.com came to rescue 🙂

Based on the code snippet in the original post, I’ve created the following script.

$props = @{
    Parameters = @(
        @{Name="rootItem"; Title="Root Item";editor="droptree";Root="/sitecore/" }
    )
    Title = "Choose Root Item"
    Description = ""
    Width = 400
    Height = 200
    ShowHints = $true
}

Read-Variable @props > $null
 
if ($rootItem -ne $null -and ![string]::IsNullOrEmpty($rootItem.ItemPath))
{
    $items = Get-ChildItem -Path $rootItem.ItemPath -Recurse | Where-Object { $_.Versions.GetVersions($true).Count -eq 0 } |`
    %{
        [PSCustomObject]@{
            "ID" = $_.ID
            "ItemName" = $_.Name
            "Item" = $_
            "ItemPath" = $_.Paths.Path
        }
    }
     
    $dlgProps = @{
        Title = "Items with no version"
        PageSize = 25
        }
    $items | Show-ListView @dlgProps -Property  @{Label="Icon"; Expression={$_.__Icon} },
        @{Label="Path"; Expression={$_.ItemPath} }
         
	Close-Window
}

I hope will be useful for you.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.