Trying to remotely remove publications using ISHRemote Remove-IshPublicationOutput

Hi,

I am writing an ISHRemote script to delete the contents of a folder on our Tridion Docs server.

The plan is to do deletions in this order:

publications, publications folder, root ditamaps, other ditamaps, maps folder, topics, topics folder.

I have started with the following code

$pubsFolder = Get-IshFolder -FolderPath $pubsFolderPath
$ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $pubsFolder
if($ishObjects.length -gt 0)
{
foreach($ishObject in $ishObjects)
{
   Remove-IshPublicationOutput -IshObject $ishObjects -Force
}
}

which executes fine the first time and $ishObjects is empty on second execution. However when I navigate into Tridion Docs webclient, I am still seeing the pre-existing publication object :-|

How is this? Am I doing the removal properly according to ISHRemote?

Any advice appreciated,

Regards,

Ann

Parents Reply Children
  • Forgive me, I am still learning :-) I thought that Remove-IshPublicationOutput -IshObject $ishObjects -Force would remove the actual publication and not the output generated from publishing the publication...so it is removing the output. After removing the publication output I then thought that I would have to explicitly remove the publication object before removing the container folder called Publications...but I didn't. I simply called Remove-IshFolder -FolderPath $pubsFolderPath and it removed the publication object and the containing folder. Is this as expeced?

    So now I am trying to remove the topics from the topics folder as follows:

    $topicsFolderPath = 'General\Import\Topics'
    $topicsFolder = Get-IshFolder -IShSession $ishSession -FolderPath $topicsFolderPath
    $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $topicsFolder
    if($ishObjects.length -gt 0)
    {
    foreach($ishObject in $ishObjects)
    {
    Remove-IshDocumentObj -IShSession $ishSession -IshObject $ishObjects -Force
    }
    }

    but I am getting the following error on the call to Remove-IshDocumentObj

    Remove-IshDocumentObj : Cannot convert 'System.Object[]' to the type 'Trisoft.ISHRemote.Objects.Public.IshObject' required by parameter
    'IshObject'. Specified method is not supported.
    At <path>\CleanScript.ps1:60 char:63
    + ... -IshDocumentObj -IShSession $ishSession -IshObject $ishObjects -Force
    + ~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Remove-IshDocumentObj], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Trisoft.ISHRemote.Cmdlets.DocumentObj.RemoveIshDocumentObj

    Any advice appreciated,

    Regards,

    Ann