I've written a script to generate a report that allows downloading a list of pages and relevant tags applied to them (within a section). In that script, I wrote the below code to download the output. For some reason, any export buttons, that Show-ListView displays, do nothing. files can't be downloaded. What is the reason for not given to download the results from Show-ListView?
$options = @{
"News" = "/sitecore/content/IFS/IFS/Home/News"
"Assets" = "/sitecore/content/IFS/IFS/Home/Assets"
"Industries" = "/sitecore/content/IFS/IFS/Home/Industries"
"Solutions" = "/sitecore/content/IFS/IFS/Home/Solutions"
"Succes" = "/sitecore/content/IFS/IFS/Home/Customer Success"
"Partners" = "/sitecore/content/IFS/IFS/Home/Partners"
}
$props = @{
Parameters = @(
@{Name="selectedOption"; Title="Choose an option"; Options=$options; Tooltip="Choose one."}
)
Title = "Option selector"
Description = "Choose the right option."
Width = 300
Height = 300
ShowHints = $true
}
$result = Read-Variable @props
if($result -ne "ok") {
Exit
}
$table = New-Object System.Data.Datatable;
$path1 = "/sitecore/content/IFS/IFS/Home/News"
$path2 = "/sitecore/content/IFS/IFS/Home/Assets"
$path3 = "/sitecore/content/IFS/IFS/Home/Industries"
$path4 = "/sitecore/content/IFS/IFS/Home/Solutions"
$path5 = "/sitecore/content/IFS/IFS/Home/Customer Success"
$path6 = "/sitecore/content/IFS/IFS/Home/Partners"
if($selectedOption -eq $path1){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Article']"
}elseif($selectedOption -eq $path2 ){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Asset']"
}elseif($selectedOption -eq $path3){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Content Page']"
}elseif($selectedOption -eq $path4){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Content Page']"
}elseif($selectedOption -eq $path5){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Customer Story']"
}elseif($selectedOption -eq $path6){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Partner Profile']"
}
[void]$table.Columns.Add("Name")
[void]$table.Columns.Add("Tag_Category")
[void]$table.Columns.Add("Tags")
ForEach ($item in $allItems) {
$name = $item.DisplayName
[void]$table.Rows.Add("$name","","")
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["CardCategory"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","CardCategory","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["ContentType"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","ContentType","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Industry"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Industry","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Language"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Language","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["ProductCategory"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","ProductCategory","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Region"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Region","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Topic"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Topic","$tag")
}
}
$table | Show-ListView -Property Name, Tag_category, Tags