As you can see from the title, I want to download images based on "search" that has been filled in Show-ListView. I recently posted another similar question about searching how to download images based on tags, that have been inputed by user.

This is the code so far:

$props = @{
    Title = "Get All Media Items by Tag"
    Description = "Get all Media items by Tag"
    OkButtonName = "Run Report"
    CancelButtonName = "Cancel"
    Parameters = @(
        @{ Name = "TagName"; Title = "Tag Name"; Editor = "field" }
        @{ Title = "Note"; Value = "Enter value of tag or set of tags"; Editor = "info" }
$result = Read-Variable @props
if($result -ne "ok") {

function Get-MediaUrl($mediaitem) {
    $siteContext = [Sitecore.Sites.SiteContext]::GetSite("website");
    $result = New-UsingBlock(New-Object Sitecore.Sites.SiteContextSwitcher $siteContext) {

$rootItem = Get-Item -Path "master:/sitecore/Media Library/Images"
$value = $TagName

@($rootItem) + @($rootItem.Axes.GetDescendants() | Initialize-Item) | 
    ForEach-Object {
        $currentItem = $_
        Get-ItemField -Item $currentItem -ReturnType Field -Name "*" `
            | ForEach-Object{ 
                if($PSItem.Value.Contains($value) -and $PSItem.Name.Contains("Tags")){
                        "ItemPath" = Get-MediaUrl($currentItem)
} | Show-ListView

This is the result of this code:

enter image description here


enter image description here

Now I need to download this images,that have been found all together. Is there any way to get these images from Show-List View and download them. The only thing that comes to my mind is getting them in another object lets say, and then download all together

  • 1
    You may be able to use a report "Action" script that zips up the media items. This could be largely based on the OOTB script to download media items. See this script in SPE 6.3 /sitecore/system/Modules/PowerShell/Script Library/SPE/Maintenance/Media Library Maintenance/Content Editor/Context Menu/Download Dec 15, 2021 at 19:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.