Getting document report using ISHRemote API

Hi,

Is there a way to view the referenced topics/images for a document using the ISHRemote API?

My end goal would be to create a report on document reuse.

Thank you,

Madison

Parents Reply Children
  • Hi Dave,

    Thank you for the reply, it was very helpful!

    I'm encountering some difficulties when trying to access the FISHLINKS metadata field for a map. When I run the code snippet below, it prints out the metadata fields for FISHLASTMODIFIEDBY and FSTATUS, but doesn't print anything for FISHLINKS. I can, however, see that the map stored in $content[0] references several topics and images if I click "Reports", then "Referenced topics and images overview for language" through the SDL content manager web client. Do you know why this is occurring?

    $folders = Get-IshFolder -ishSession $ishSession -FolderId $folderID -Recurse
    $content = $folders | Get-IshFolderContent -IshSession $ishSession

    Get-IshMetadataField -IshSession $ishSession -Name FISHLASTMODIFIEDBY -Level Lng -IshObject $content[0]
    Get-IshMetadataField -IshSession $ishSession -Name FSTATUS -Level Lng -IshObject $content[0]
    Get-IshMetadataField -IshSession $ishSession -Name FISHLINKS -Level Lng -IshObject $content[0]

    Thank you,

    Madison

  • Hi Madison,

    Every object in the Content Manager system has many fields defined, which are categorized in System (S), Descriptive (D) and Basic (B). Have a look at the difference on https://github.com/sdl/ISHRemote/blob/master/Doc/ReleaseNotes-ISHRemote-0.7.md section "Sample - Descriptive, Basic and All Fields"

    You can recognize which fields are part of which group by the SDB column when running Get-IshTypeFieldDefinition

    To connect the dots, your Get-IshFolderContent call uses the default value of $ishSession.DefaultRequestedMetadata which is to NOT return system fields like FISHLINK. Hence when you do your lookup, it shows up empty.

    The simple way out is to do: $ishSession.DefaultRequestedMetadata = 'All'. This however means you are retrieving literally all fields which has a potential severe performance impact! So okay for a small data set or a one time run.

    If you run your script often, I would suggest to explicitly request the specific fields you need by a: Get-IshDocumentObj -IshObject $content -RequestedMetadata (Set-IshRequestedMetadataField -Name FISHLINKS -Level Lng | Set-IshRequestedMetadataField ...)

    Small hint on your Get-IshMetadataField usage, since ISHRemote 0.7 you can use the provided PSNoteProperties, see inside https://github.com/sdl/ISHRemote/releases/tag/v0.7 In short you can write: $content[0].fishlinks

    Hope this helps,
    Dave


    My test script eventually...

    $folders = Get-IshFolder -BaseFolder Favorites -Recurse
    foreach ($folder in $folders)
    {
        $ishobjects = Get-IshFolderContent -IshFolder $folders
        $ishobjects = Get-IshDocumentObj -IshObject $ishobjects -RequestedMetadata (Set-IshRequestedMetadataField -Name FISHLINKS -Level Lng)
    }
    foreach ($ishobject in $ishobjects)
    {
        $ishobject.fishlinks
    }