I have got
$eventsPath = "/sitecore/content/Global Content/Events"
$templateId = "{EBE88C21-4035-4266-9647-B4C88F1BC000}"
# Function to get data and print on the screen
function Print-EventData($item) {
$nId = $item.ID
$title = $item.Name
$created = $item.Statistics.Created
$changed = $item.Statistics.Updated
$eventDetails = $item.PSFields.'Event Title'.value
#image
$imagePath = $item.PsFields.'image'.value
#searchTags
$searchTags = $item.PsFields.'Search Tags'.GetItems() | ForEach-Object { $_.DisplayName }
$searchTagsString = if ($searchTags) { $searchTags -join '|' } else { "NA" }
#field_domain_acess
$relatedSiteDetails = $item.PsFields.'Related Site'.GetItems() | ForEach-Object { $_.DisplayName }
$relatedSite = if ($relatedSiteDetails) { $relatedSiteDetails -join '|' } else { "NA" }
#field_event_catogery
$eventCategory = $item.PsFields.'Event Category'.GetItems() | ForEach-Object { $_.DisplayName }
$eventCategoryString = if ($eventCategory) { $eventCategory -join '|' } else { "NA" }
#Write-Host "$relatedSiteDetails"
Write-Host "Item ID:$nId , title = $title , Created: $created, changed: $changed, Image Path: $imagePath, Searchtags: $searchTagsString, field_domain_acess: $relatedSite "
}
# Get the root item
$rootItem = Get-Item -Path $eventsPath
# Process the root item and its children
foreach ($item in Get-ChildItem -Path $rootItem.FullPath -Recurse) {
if ($item.TemplateID -eq $templateId) {
Print-EventData -item $item
}
}
how can I get the equivalent result in master index using Find-Item