Hi
How do I get a list of publications (not publicationOutput)?
Each publication should be listed once, even if it has been published with three different output types
Thanks!
Hi
How do I get a list of publications (not publicationOutput)?
Each publication should be listed once, even if it has been published with three different output types
Thanks!
Hi Milly,
If you use the Find-ISHPublicationOutput you will get the list of publications for all available PublicationOutputs. You will need to make the distinct from the list yourself
Alternative approach would be to use the API wrapper which is also supported through ISHRemote.
eg.
$mySession.PublicationOutput25.Find("ISHNoStatusFilter", "", "<ishfields><ishfield name='FTITLE' level='logical'/></ishfields>")
where $mySession is your session object returned by the New-ISHSession command used to authenticate to SDL Tridion Docs.
This sample will return the distinct list of logical level publication objects only.
Kind Regards,
Raf
Besides Raf suggestion, there are two other routes...
The first being to export to Excel and do your action there. The https://github.com/dfinke/ImportExcel module is very handy for that. So with that PowerShell module installed, your command would look:
Find-IshPublicationOutput | Export-Excel
To stay within PowerShell, I would use:
Find-IshPublicationOutput | Sort-Object -Property IshRef,version_version_value -Unique
Thanks, Raf. It works like a charm. I assume I can modify the command to retrieve FISHMASTERREF as well.
Hi Milly,
Yes you can modify the command to retrieve any property you like, as long as you use the correct name/level combinations.
So for FISHMASTERREF this would be changed into:
<ishfields><ishfield name='FISHMASTERREF' level='version'/></ishfields>
or the combined retrieval:
<ishfields><ishfield name='FTITLE' level='logical'/><ishfield name='FISHMASTERREF' level='version'/></ishfields>
Hi Dave, if I would like the highest version of the available ones in my search result, is there way to do that using this line of code?
Hi Pia,
Just to make sure, the ISHRemote terminology is that a "Find" operator is a relational database query (think SQL Server, Oracle, etc). And a "Search" is a Full-Text-Index (think Solr, OpenSearch, Google, etc) query. I assume a "Find" because you want an exact answer. Beware that a Find-result could theoretically return your full database if you don't filter enough; which is okay on smaller CMS instances, but coudl be problematic for enterprise sizes.
The API call used behind Find-IshPublicationOutput is PublicationOutput 2.5 Find which in turn states "When filtering on version numbers in psXMLMetaDataFilter
, only exact version numbers can be used.". There are API calls that allow you to use the LATEST keyword as a version filter as described on Understanding how version numbers behave.
So server-side filtering close to the data, not in the ISHRemote client, you can do
$ishObjects = Get-IshFolder -BaseFolder Data -FolderTypeFilter @("ISHPublication") -Recurse | Get-IshFolderContent -VersionFilter LATEST
So the Get-IshFolder iteratively loops your repository folder structure and only passes Publication folders to the next cmdlet. This next Get-IshFolderContent cmdlet only retrieves LATEST versions of Publications. You can also use this cmdlet to filter even further adding language or other metadata filters like
$metadataFilter = Set-IshMetadataFilterField -Level Lng -Name FISHPUBSTATUS -ValueType Element -FilterOperator In -Value VPUBSTATUSUNPUBLISHFAILED $ishObjects = Get-IshFolder -BaseFolder Data -FolderTypeFilter @("ISHPublication") -Recurse | Get-IshFolderContent -VersionFilter LATEST -LanguagesFilter ('en-US','de-DE') -MetadataFilter $metadataFilter
Best wishes,
Dave