How can I check a folder for topics with a given attribute and value?

Hi,

I want to check a folder path for all topics that have a certain metadata attribute and a certain chunk of XML i.e. <section outputclass="instructions"

So far I have (what Dave advised in previous question)

$metadataFilter = Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator IN -Value 'en' |
                             Set-IshMetadataFilterField -Level Lng -Name FSTATUS -FilterOperator Equal -Value 'Released'

$ishObjects = Get-IshFolder -FolderPath $ishFolder -FolderTypeFilter @("ISHModule") -Recurse |
Foreach-Object {
# find the latestreleased topics for each version
$ishVersionObjects = Get-IshFolderContent -IshFolder $PSItem -MetadataFilter $metadataFilter -VersionFilter latestreleased |
Get-IshDocumentObj
# at this point variable $ishVersionObjects contains the Latest-Released-Version with FSTATUS=Released and DOC-LANGUAGE=en-US

Foreach ($ishVersionObject in $ishVersionObjects) {
  # do something per entry found here
  Write-Host ("Found LogicalId["+$ishVersionObject.IshRef+"] Version["+$ishVersionObject.version_version_value+"] Lang["+$ishVersionObject.doclanguage+"] Author["+$ishVersionObject.fauthor+"]")
  $encodedContent = $ishVersionObject.IshData
  # Decode the Base64-encoded content into XML
  $xmlContent = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedContent))

  }
}

However, I am getting error 

Exception calling "FromBase64String" with "1" argument(s): "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding
characters. "

Can anyone advice how I access and test for a given piece of XML in topic being processed?

Any advice appreciated,

Regards,

Ann

emoji