ISHRemote - How to autocomplete baseline of a publication using ISHRemote?

Hello,

I am new to ISHRemote and need help to create a script. Sorry if this was already asked somewhere, but wasn't able to find anything related. 

Context

I am trying to build a script to publish a publication using ISHRemote. I want my script to:

  1. Access Tridion
  2. Access a publication in a given folder
  3. Add a map to a publication
  4. Autocomplete the baseline of the publication and push to latest Release status all objects in it
  5. Publish Outputs already configured in the publication

Tridion Info

  • Tridion 14
  • Build 14.0.6113.4

Issue

I was able to create something that works, but I am stuck on step #4. I just can't seem to find a way of doing this. Whatever I try, the script can't read objects in the baseline.

Is it possible to autocomplete the baseline of a publication and push all objects (map, topics, images, libraries) in it to the latest Release status

Thanks,

Steven

emoji
Parents
  • Hi Steven,

    Thanks for your question. And if this is your first script, I would say a challenging question. So yes, it is possible and I would look at...

    1. Access over cmdlet New-IshSession
    2. Find-IshPublicationOutput or Get-IshFolder | Get-IShFolderContent
    3. Set-IshPublicationOutput and the field you need is version-level FISHMASTERREF
    4. $ishSession.Baseline25.CompleteBaseline... and then I would first attempt Set-IShBaselineItem
    5. Publish-IshPublicationOutput

    Besides I can also share that Publication Manager is fully working on the exact same API as ISHRemote. So whatever you can see Publication Manager do, by for example Fiddler, is what you could do as well.

    Furthermore ISHRemote offers easy to consume cmdlets for the API, however it is absolutely not covering all of the API. For that you can use the pre-authenticated proxies on the generated $ishSession so try $ishSession.Application25.GetVersion() for example.

    Interesting community threads are...

    if you next time could share some code you might get some extra hints on "the script can't read objects in the baseline

    ISHRemote is open-source, so there are some desired cmdlets listed like 

    Best wishes,
    Dave

    emoji
  • Hello Dave,

    I am struggling to add objects to the baseline. Everything is being rejected. 

    Details:

    • Tridion Docs Server: 14.0.5923.4
    • ISHRemote: 7.0.0
    • PowerShell: 5.1
    • Key Cmdlets Available: Add-IshBaseline, Set-IshBaselineItem, Get-IshDocumentObj, Remove-IshBaseline (New-IshObject is NOT available)
    • OS: Windows 11

    I was able to:

    • Create a baseline using Add-IshBaseline
    • Run Baseline25.CompleteBaselineByCandidateAndMode(), which returns XX items

    I wasn't able to:

    Add objects to the baseline after autocomplete. Every attempt to call Baseline25.Update() with XML results in schema errors such as:

    • The 'ISHBaselineModifications' element is not declared.
    • The 'ishbaseline' element is not declared.
    • The 'ishobjects' element is not declared.

    Attempts to change baseline status fail:

    • Field FISHBASELINESTATUS does not exist.

    Attempts to retrieve metadata schema fail:

    • ActivityFilter enum cannot convert empty string

    Attempts to use Set-IshBaselineItem also fail:

    • Cannot bind parameter IshObject

    Questions

    • In my Tridion Docs 14.0.5923.4, is it possible to add objects of a baseline after Create() + CompleteBaseline…()? 
    • If yes, would you have some working example please? 

    Code Snippet

    # Connect (ISHRemote 7.0.0 already imported)
    $IshSession = New-IshSession -WsBaseUrl $url -UserName $user -Password $pass
    
    # 1. Create baseline
    $baselineName = "TestBaseline_" + (Get-Date -Format "yyyyMMdd_HHmmss")
    $created = Add-IshBaseline -Name $baselineName -Description "Test baseline"
    $baselineId = $created.IshRef
    
    Write-Host "Created baseline: $baselineId"
    
    # 2. Autocomplete baseline
    # (Using a real master map GUID in my environment)
    $masterMapGuid = "GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    $langs = @("en-US")
    $resolutions = @("High")
    
    $xmlAutocomplete = $IshSession.Baseline25.CompleteBaselineByCandidateAndMode(
        $baselineId,
        $masterMapGuid,
        "ISHLatestReleased",
        $null,
        $null,
        $langs,
        $null,
        $null,
        $resolutions
    )
    
    Write-Host "Autocomplete returned XML length:" $xmlAutocomplete.Length
    
    # 3. Try to modify baseline content via Update()
    # (minimal example: attempt to add one object)
    $xmlChanges = @"
    <ISHBaselineModifications>
      <ISHBaselineObject>
        <IshObjectRef>$masterMapGuid</IshObjectRef>
      </ISHBaselineObject>
    </ISHBaselineModifications>
    "@
    
    Write-Host "Sending Update() with XML:" 
    Write-Host $xmlChanges
    
    # 4. Update -> always fails in my environment
    try {
        $IshSession.Baseline25.Update($baselineId, $xmlChanges)
        Write-Host "Update succeeded"
    }
    catch {
        Write-Host "Update FAILED:" $_.Exception.Message
    }
    

    Thanks again for your help on this one.

    Regards,

    Steven

    emoji
  • Apologies for the comm gap. I feel this request is already a heavy list for a public forum.

    Just to make sure we are not chasing old bugs, can you update ISHRemote from v7 to v8.1 (or v8.2 preview).

    # 3. Try to modify baseline content via Update()
    # (minimal example: attempt to add one object)
    $xmlChanges = @"
    <ISHBaselineModifications>
      <ISHBaselineObject>
        <IshObjectRef>$masterMapGuid</IshObjectRef>
      </ISHBaselineObject>
    </ISHBaselineModifications>
    "@

    Regarding above code sample, can you highlight where you got inspired to use this template?

    After all, when using $ishSession.Baseline25 you are actually using the SOAP proxy. These proxy classes are documented, so I expected more something like

    Best wishes,
    Dave

    emoji
Reply Children
No Data