Does ISHRemote only see a Document Object if it has object, version and language layer present?

Hi,

I am still researching and trying to understand the workings of ISHRemote for manipulating objects in Tridion Docs.

While testing various calls to Get-IshDocumentObj it appears to sometimes remove only the language layer of a document object.

When I view the document object in Tridion Web Client I can still see the Object and Version layer. However, when I test further attempts to get or remove this object view ISHRemote, it doesn't find it.

Can anyone explain the visibility of a topic object in Tridion Web Client that cannot be seen via call to Get-IshDocumentObj using ISHRemote?

Any feedback appreciated,

Regards,

Ann

Parents Reply
  • Hi Dave,

    I have just discovered that this problem that I am having seems to be influenced by a topic that has the DITA <draft-comment> element in it. If I leave this element in the topic I get the following 3 issues:

    1. An error on importing the DITA content via the Content Importer (this is how I am getting it into Tridion Docs)

    2. An extra folder called Topics is generated within the main Topics folder in Tridion :-|

    3. The other topic object (Training Instructions) remains in the CMS but without a version or language layer

    If I remove this <draft-comment> element, everything imports fine and my PowerShell script works perfectly and removes everything.

    This all seems very odd to me but it might ring a bell with you or someone else reading this?

    Regards,

    Ann

Children
  • Thanks Ann - I would not point at the <draft-comment> as the culprit. From the picture I would derive that your "Reference" topic was used (so some xref or href is pointing to the LogicalId GUID of your "Reference") by another topic. The system would block you from deleting the "Reference" topic, as it was still being used by other topics that you didn't delete yet. So it looks like you are running into referential integrity here, although your intention is to remove all.

    Looking at github.com/.../RemoveIshDocumentObj.cs, that logical-level-only "Reference" from your screenshot cannot be deleted by ISHRemote cmdlets. It can be deleted over the API however.

  • Hi Dave, 

    I am back to this problem again and yes I can see the xref in topic1 referencing topic2 and resulting in topic2 object layer not being removed after call to Remove-IshDocumentObj.

    So if I want to complete this code to remove the entire topic (language, version and object layers) then I need to use the API.

    Can you advise if I can call the API from the same PowerShell script that I have been building so far (with ISHRemote cmdlets) or do I need to wrap it all in a program developed in another language e.g. Java?

    Any advice appreciated,

    Regards,

    Ann

  • Hi Ann,

    The WCF proxies are available for a direct API call, so security/authN is already handled :-)

    $ishSession = New-IshSession -WsBaseUrl https://ish.example.com/ISHWS/ -PSCredential admin
    $ishSession.DocumentObj25.Delete("MyLogicalIDGUID", "", "", "", "")

    On how the function looks like, see https://docs.sdl.com/796504/421408/sdl-tridion-docs-14-sp2/documentobj-2-5-delete The above code tries to remove the whole object all logical/version/language still respecting referential integrity, so perhaps you need a loop to try again. 

    I didn't test the sample as I didn't have a database which I could delete in handy :-) 

    -Dave

  • Hi Dave,

    Thanks for your reply. I see the docs for the function says "Delete Will Fail...if the map is referenced by another map". How does this differ to calling ISHRemote cmdlet Remove-IshDocumentObj?

    When I test and call $ishSession.DocumentObj25.Delete it seems to only remove the language layer whereas Remove-IshDocumentObj removes both the language and version layer. Whatever way I try to delete a topic that is referenced from elsewhere, once the language layer is gone then the logical / object layer isn't seen by ISHRemote so I cannot do any further processing to something that is invisible. 

    Am I trying to do the impossible here or is there some way to achieve this?

    Also, I seem to be getting very few responses on my questions and wonder if there is another forum/site that community members use?

    Thanks in advance,

    Ann

  • Hi Dave,

    Sorry to bug you again but you do seem to be the only person in this community who can advise me.

    I see the API docs for the function says "Delete Will Fail...if the map is referenced by another map".

    How does this differ to calling ISHRemote cmdlet Remove-IshDocumentObj?

    When I test and call $ishSession.DocumentObj25.Delete it seems to only remove the language layer whereas Remove-IshDocumentObj removes both the language and version layer. Whatever way I try to delete a topic that is referenced from elsewhere, once the language layer is gone then the logical / object layer isn't seen by ISHRemote so I cannot do any further processing to something that is invisible :-|

    Can you provide me with any more guidance on this? Am I trying to do something that can't be done?

    Thanks,

    Ann

  • Hi Ann,

    It does not differ 'Remove-IshDocumentObj' eventually calls the Delete API function as you can see on https://github.com/sdl/ISHRemote/blob/master/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/RemoveIshDocumentObj.cs line 208. The main difference is that ISHRemote in total expects full logical-version-language, and only the delete tries to do cleanup for the last version (if all languages are gone) and also for the logical (if all versions and languages are gone).

    Now what you experience is that delete of that last logical level is blocked. And that will be the same for ISHRemote and the API call.

    So there are some best practices, as delete the pyramid of information in order

    1. Publications first as they reference (root) maps and resources (typically library topics)
    2. Then root maps, sub maps, etc as they reference topics
    3. Then Topics as they reference images and conrefs and variables (typically offered by library topics)
    4. Then Library Topics who could reference each other or images
    5. Then Images

    Another approach if you don't know or care about the information architecture is to brute-force loop. If you 10 objects referencing each other, probably one is top of the pyramid and the others will fail, so one delete will work. Enabling the next delete in the next loop.

    I understand - and experienced it multiple times myself - that referential integrity is part of the CMS and especially complicates negative/removal operations. Of course that is one of those things that set the CMS apart from a folder with files.

    Best wishes,
    Dave