Getting contents of a publication

I'm trying to read the contents of a publication file. Here's my attempt:

$ishSession = New-IshSession -WsBaseUrl xxx.sdlproducts.com/.../ -ishUserName xxx -ishPassword "xxxx"

$ishSession.DefaultRequestedMetadata = 'All';

$pfolder = Get-IshFolder -FolderPath "\General\_Global\_Resource Library\Tools\Cross Reference Tool\Publications"
$pobjects = Get-IshFolderContent -ishfolder $pfolder
foreach ($pobject in $pobjects)
{
    $pub = Get-IshDocumentObjData -ishobject $pobject -FolderPath "C:\tmp" -Debug
}

$pobject is of type ISHPublication, but Get-IshDocumentObjData generates the following:

Get-IshDocumentObjData : Buffer cannot be null.
Parameter name: array
At line:15 char:12
+ $pub = Get-IshDocumentObjData -ishobject $pobject -FolderPath "C: ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-IshDocumentObjData], ArgumentNullException
+ FullyQualifiedErrorId : GetIshDocumentObjData,Trisoft.ISHRemote.Cmdlets.DocumentObj.GetIshDocumentObjData

Parents
  • Hi Dave,

    You are actually pretty close, the key thing is that you should look at PublicationOutputs (so the actual ZIP or PDF or CHM or whatever target of publishing file) while DocumentObj (is about topics, library topics, maps, images, etc).

    I've tested with this pipeline friendly version, where output of the previous cmdlet is passed to the next (without explicit -IshObject usage)

    $fileInfo = Get-IshFolder -BaseFolder Data -FolderTypeFilter @("ISHPublication")  -Recurse |
    Get-IshFolderContent |
    Get-IshPublicationOutputData -FolderPath C:\temp\20210701.ISHRemote

    Theoretically adapting your code, it would look like

    $pfolder = Get-IshFolder -FolderPath "\General\_Global\_Resource Library\Tools\Cross Reference Tool\Publications"
    $pobjects = Get-IshFolderContent -ishfolder $pfolder
    foreach ($pobject in $pobjects)
    {
        $pub = Get-IshPublicationOutputData -ishobject $pobject -FolderPath "C:\tmp" 
    }

    If I may, some remarks

    • $ishSession.DefaultRequestedMetadata = 'All' indicates to retrieve more metadata or actually all metadata of objects, which in this example only slows down Get-IshFolderContent as you are not using it later on, in this sample
    • your returned $pub contains .NET FileInfo objects... so in essence it returns you filenames so you can do something with the downloaded PDFs, ZIPs, etc
    • If you are on ISHRemote v0.13 or higher, than Get-IshFolderContent offers several filter parameters (like latest version only, or languages or custom filter metadata, etc)

    Best wishes,
    Dave ;-)

  • Hi, 

    I have been trying to use the -FolderTypeFilter parameter as follows

    Get-IshFolder -IShSession $ishSession -FolderPath "<folder path>" -Recurse -FolderTypeFilter @("ISHPublication") | Get-IshFolderLocation -IshSession $ishSession | Out-File C:\scripts\text3.csv

    but am getting error

    PS C:\WINDOWS\system32> 
    Get-IshFolder : A parameter cannot be found that matches parameter name 'FolderTypeFilter'.

    I have v 14 of ISHRemote module installed.

    Any advice appreciated,

    Regards,

    Ann

  • Get-IshFolder -FolderPath "\General" -Recurse -FolderTypeFilter @("ISHPublication")

    The above works for me... if a parameter does not exist, I would suggest to double check the ISHRemote version. That check is quite easy, if you execute $ishSession you will see two parameters: ClientVersion and ServerVersion. Can you share those?

    -Dave

Reply Children