Skip to content

Instantly share code, notes, and snippets.

@ddemeyer
Last active August 2, 2018 12:49
Show Gist options
  • Save ddemeyer/5dd0d0ed17948c9448827d9abfb0ff9f to your computer and use it in GitHub Desktop.
Save ddemeyer/5dd0d0ed17948c9448827d9abfb0ff9f to your computer and use it in GitHub Desktop.
Starting from Tridion Docs 13SP1 you always need an existing Editor Template to be able to create content objects like Topics, Images, Maps, and Other. Typically they are there, the Other might be an issue. The below snippet gets you going of adding the first/initial one using the API through ISHRemote.
$ishSession = New-IshSession -WsBaseUrl "https://example.com/ISHWS/" -PSCredential "Admin"
# Manually create a folder of type 'Other' and provide it as FolderPath parameter
$otherIshFolder = Get-IshFolder -IshSession $ishSession -FolderPath "\System Management\Editor Templates\Other\" # Please verify
# Below code creates an empty text file and creates your initial Other content object
Set-Content -Path "$env:TEMP\empty.txt" -Value "Empty Text File, or not" -Force
$metadata = Set-IshMetadataField -IshSession $ishSession -Level Logical -Name FTITLE -Value "Empty Template" |
Set-IshMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element -Value VUSERADMIN |
Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value VSTATUSDRAFT
Add-IshDocumentObj -IshSession $ishSession -IshFolder $otherIshFolder -IshType ISHTemplate -LogicalId ISHEDITORTEMPLATETXT -Metadata $metadata -Lng en -Edt "EDT-TEXT" -FilePath "$env:TEMP\empty.txt"
# Once the object is created, manually push it through the workflow as Editor Templates need to be (R)eleased before they show up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment