Problem getting latest version metadata filter working

I am trying to use the metadata filter below with find-ishDocumentObj in PowerShell and it returns zero docs. If I block the last line that defines the version as 'latest' it works but returns multiple ishmodules. Can someone tell me what I am doing wrong? Does 'latest' not work with a metadata filter? 


$metadataFilter =

Set-IshMetadataFilterField -IshSession $ishSession -Name "DOC-LANGUAGE" -Level "Lng" -FilterOperator "equal" -Value "en-US" |

Set-IshMetadataFilterField -IshSession $ishSession -Name "CREATED-ON" -Level "version" -FilterOperator "greaterthan" -Value "14/6/2016 00:00:00" |

Set-IshMetadataFilterField -IshSession $ishSession -Name "CREATED-ON" -Level "version" -FilterOperator "lessthan" -Value "14/12/2017 00:00:00" |

Set-IshMetadataFilterField -IshSession $ishSession -Name "VERSION" -Level "version" -FilterOperator "equal" -Value "latest"





  • Dear Rick,

    I think latest for the MetadataFilterField definitions should be changed toward latestafterfilter and the -FilterOperator which is optional should be removed from the Set-IshMetadataFilterField call.

    So I think the statement should be

    Set-IshMetadataFilterField -IshSession $ishSession -Name "VERSION" -Level "version" -Value "latestafterfilter"

    More information about the behavior of the version numbers can be found in the documentation at the following page:
    (Understanding how version numbers behave)

    Kind Regards,

  • Thank Raf, I made the change but it still returns zero. With the code below, the count returned is 124 if I remove the Version filter field. With the version filter field, it returns zero. If it returns the latest, does that mean that the topics being returned are not the latest, so it returns zero?

    $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name "DOC-LANGUAGE" -Level "Lng" -FilterOperator "equal" -Value "en-US"  |

    Set-IshMetadataFilterField -IshSession $ishSession -Name "CREATED-ON" -Level "version" -FilterOperator "greaterthan" -Value "14/6/2016 00:00:00" |

    Set-IshMetadataFilterField -IshSession $ishSession -Name "CREATED-ON" -Level "version" -FilterOperator "lessthan" -Value "30/6/2016 00:00:00" |

    Set-IshMetadataFilterField -IshSession $ishSession -Name "VERSION" -Level "version" -Value "latestafterfilter"

    $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name 'FTITLE' -Level "logical" |

    Set-IshRequestedMetadataField -IshSession $ishSession -Name 'CREATED-ON' -Level "Version" |

    Set-IshRequestedMetadataField -IshSession $ishSession -Name 'FAUTHOR' -Level "Lng" |

    Set-IshRequestedMetadataField -IshSession $ishSession -Name 'VERSION' -Level "Version"

    $topicsFound = Find-IshDocumentObj -IshSession $ishSession -IshTypeFilter ishModule -MetadataFilter $metadataFilter -RequestedMetadata $requestedMetadata


  • The short answer is, not possible.

    The longer answer... The PowerShell ISHRemote package is in the end a convenience to allow automation on top of the API. Now looking somewhat deeper into Find-IshDocumentObj, it relies on DocumentObj25.Find which has a metadataFilter parameter. However the metadataFilter doesn't support the version keywords as described on TD13SP1 - Understanding how version numbers behave. Those version keywords - like latestafterfilter - are only supported on API functions that have a direct version parameter and not an indirect version filter as presented through the metadataFilter parameter.

    So just thinking along... I see you pass version-level CREATED-ON fields so you get multiple hits on that, then you can filter on VERSION client-side.

  • Well actually, ISHRemote has a backlog, actually a really big one (public and also private in my notes :-))
    Now the public one has two ideas listed for client-side filtering

    Any thoughts?

  • Thanks Dave,

    I decided to go with your first suggestion and filter on the client using GET-UNIQUE. I was thinking it would reduce data be getting the latest version but it didn't turn out to be that much data after all. I appreciate the help.