Ho to remove publications and topics using ISHRemote

Hi,

Posting here instead of Product Groups.

I have been trying to use Remove-IshPublicationOutput -IshObject $ishObjects -Force and find that it is only successful if the publication has been published but how do I remove a publication object that does not have an associated output object with it?

Now I am also 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

  • Hi An,

    Developer Forum is a nice place for this... the error message says it, you are passing an array object "[ ]" where your intent was to pass a single object. Or more practical, you have a for loop around the Remove-cmdlet but you still pass the group $ishObjects (plural s)

    -Dave

  • Hi Dave,

    Thanks for your reply. I have removed the for loop and am calling Remove-IshDocumentObj passing it the array of objects in the $ishObjects variable because the docs for Remove-IshDocumentObj says that it takes an argument specified by - IshObject which is an "Array with the objects to remove." But I am still getting the same error message-

    Remove-IshDocumentObj : Cannot convert 'System.Object[]' to the type 'Trisoft.ISHRemote.Objects.Public.IshObject' required by parameter
    'IshObject'. Specified method is not supported.
    At C:\Users\annjense\Documents\PowerShell\CleanDita101_Tridion.ps1:77 char:61
    + ... -IshDocumentObj -IShSession $ishSession -IshObject $ishObjects -Force
    + ~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Remove-IshDocumentObj], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Trisoft.ISHRemote.Cmdlets.DocumentObj.RemoveIshDocumentObj

    I feel like I am misinterpreting something fundamental to how IshRemote works. My background is OO development so maybe that conditioning is skewing my expectations.

    Any further feedback appreciated,

    Regards,

    Ann