Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$database = "master"
$selectedItem = Get-Item -Path (@{$true="$($database):\content\home"; $false="$($database):\content"}[(Test-Path -Path "$($database):\content\home")])
$props = @{
Parameters = @(
@{Name="selectedItem"; Title="Choose the Sitecore Item to to view its Renderings Settings"; Tooltip="All Final Renderings and their settings for this item wil be listed "; }
)
Title = "List Rendering Cache Settings for Content Item"
Description = "Please select Content Item"
Width = 550
Height = 300
ShowHints = $true
Icon = [regex]::Replace($PSScript.Appearance.Icon, "Office", "OfficeWhite", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
}
$result = Read-Variable @props
if($result -eq "cancel") {
exit
}
if ($selectedItem.length -ge 1) {
$selectedItemID = $selectedItem.ID
}
$defaultLayout = Get-LayoutDevice -Default
$selectedItem = Get-Item -Path "master:" -ID $selectedItemID
$Results = @();
$renderings = Get-Rendering -Item $selectedItem -Device $defaultLayout -FinalLayout
foreach($rendering in $renderings){
if($rendering.ItemID -ne $null)
{
$renderingItem = Get-Item master: -ID $rendering.ItemID
if($renderingItem -ne $null)
{
$Properties = @{
Page = $rootItem.Name
RenderingItemName = $renderingItem.Name
RenderingItemID = $renderingItem.ID
RenderingItemPath = $renderingItem.Paths.Path
Global_Cacheable = $renderingItem.Cacheable
Global_ClearOnIndexUpdate = $renderingItem.ClearOnIndexUpdate
Global_VaryByData = $renderingItem.VaryByData
Global_VaryByDevice = $renderingItem.VaryByDevice
Global_VaryByLogin = $renderingItem.VaryByLogin
Global_VaryByParm = $renderingItem.VaryByParm
Global_VaryByQueryString = $renderingItem.VaryByQueryString
Global_VaryByUser = $renderingItem.VaryByUser
}
$Results += New-Object psobject -Property $Properties
}
}
}
$Results | Select-Object Page, RenderingItemName,RenderingItemID,RenderingItemPath,Global_Cacheable, Global_ClearOnIndexUpdate, Global_VaryBy* | Show-ListView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.