DocumentOb25.CheckOut throws an error using powershell.

I'm trying to check out a topic, modify it, then check it back in via the API, but I get this error:

Cannot find an overload for "CheckOut" and the argument count: "6".
At C:\Users\msemrick\OneDrive - Tesla\Desktop\checkout.ps1:14 char:1
+ $ishSession.DocumentObj25.CheckOut(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

The code is:

# Establish a session
$ishSession = New-IshSession -WsBaseUrl $server -IshUserName $username -IshPassword $password

# Checkout the document
$ishSession.DocumentObj25.CheckOut(
    "GUID-XXX...", #psLocgicalId
    3, #psVersion
    "en-US", #psLanguage
    "", #psResolution
    "", #psXMLRequiredCurrentMetadata
    "" #psXMLRequestedMetadata
    )

emoji
Parents Reply
  • If it really is an automated (fast) process then I would skip the Checkout/Checkin phase... Checkout/Checkin - or some people like to call it Lock/Unlock - is something user oriented.

    I think in your scenario you can be a lot more optimistic. So your scenario looks quite pessimistic expecting concurrancy, doing a Checkout and potentially doing error handling if somebody else already has the Lock (read Checkout). In an optimistic scenario, you just download (Get-IshDocumentObjData) and update (Set-IshDocumentObj)... where if you run ISHRemote as a non-Administrator user you will not be allowed to update locked/checked out content. If you are running as Administrator then that update would even be succesfull (but probably not wanted).

    Have a look at the Set-IshDocumentObj -FileContent test line 328 in github.com/.../SetIshDocumentObj.Tests.ps1

    emoji
Children