2

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

enter image description here

Please help me. Thank you

4
  • Are you getting any errors in logs when you click to download? Commented Sep 21, 2022 at 11:04
  • No, I don't get any errors. But the export buttons are not working. Commented Sep 21, 2022 at 11:25
  • It's commonly a configuration problem. The docs outline which services need to be enabled for downloading to work. Commented Sep 21, 2022 at 11:34
  • I believe it's the Handle Download service. doc.sitecorepowershell.com/security#service-descriptions Commented Sep 21, 2022 at 14:17

1 Answer 1

2

See this conversation here on github as @WulfgarDK is saying above - https://github.com/SitecorePowerShell/Console/issues/912

But this was not the reason in our case.

We had the same issue and solution was to enable Spe.IdentityServer.config at \inetpub\wwwroot\website\App_Config\Include\Spe.

OOTB this file comes with Sitecore Powershell module as disabled. Just need to remove .disabled from the config name.

enter image description here

1
  • 1
    Thank you so much. This works for me Commented Sep 22, 2022 at 4:42

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.