I want to compare two MultiList in terms of, comparing Selected Items. I have a MultiList where users can select what items they want to be selected.
Here is the image of it:
Now I have a Tagging
section, like almost every item, in Media Item, and there items can also be selected. Now I am asking, is it possible to compare Selected Items from the "user MultiList", like when user can select what they want, to the MultiList in Media Item
Here is the code so far:
@($rootItem) + @($rootItem.Axes.GetDescendants() | Initialize-Item) |
ForEach-Object {
$currentItem = $_
Get-ItemField -IncludeStandardFields -Item $currentItem -ReturnType Field -Name "*" `
| ForEach-Object{
ForEach($i in $value) {
if($PSItem.Value -match $i.DisplayName -and $PSItem.Name.Contains("__Semantics")){
[pscustomobject]@{
"Name"=$currentItem.DisplayName
"ItemId"=$currentItem.ID
"FieldName"=$_.Name
"ItemPath" = Get-MediaUrl($currentItem)
}
Copy-Item -Path $currentItem.ItemPath -Destination $folderToMove.Paths.FullPath;
}
}
}
} | Sort-Object -Unique ItemID | Show-ListView
$rootItem
is just the path to the folder, for example sitecore/Media Library/Images
$value
is the value from the MultiList display names