Hi Antonio Jose,
here is a complete script that updates a Royal Document hosted by Royal Server via PowerShell:
Import-Module RoyalDocument.PowerShell Import-Module RoyalServer.PowerShell $fileName = "c:\temp\Test.rtsz" $serverIp = "127.0.0.1" $serverport = 54899 $username = "user" $password = "pwd" #create a store object $store = New-RoyalStore -UserName "ScriptUser" $tempdoc = New-RoyalDocument -Store $store -Name "tempdoc" -FileName $fileName $server = New-RoyalObject -Folder $tempdoc -Type RoyalManagementEndpoint -Name "royal server" $server.RoyalServerHost = $serverIp $server.RoyalServerCredentialMode = 1 #specify username/password $server.RoyalServerPort = $serverport $server.RoyalServerProtocol = 1 #https $server.RoyalServerUsername = $username $server.RoyalServerPassword = $password $hostedDocs = Get-RoyalServerDocument -RoyalServer $server # for this example, load the 1st document $hostedDoc = $hostedDocs[0] $doc = Open-RoyalServerDocument -RoyalServer $server -RoyalServerDocument $hostedDoc # add an object $testObject = New-RoyalObject -folder $doc -Type RoyalManagementEndpoint -Name "Royal Server Object Test" -Description "description" # save the doc back to royal server Out-RoyalServerDocument -Document $doc -RoyalServer $server -RoyalServerDocument $hostedDoc
Remark: adapt the variables accordingly.
You first need to load the list of already hosted documents and chose one, then load this one, edit it and save it back.
Let me know if this helps.
cheers,
Michael
Thanks, It's working now.
Hi Antonio Jose,
thanks for the feedback.
Let me know if you have any other questions.
cheers,
Michael
Perez, Antonio Jose
I'm having some issues when trying to save the modifications in my royal server document.
I'm opening an existing document like mentioned in this other thread
https://support.royalapps.com/support/discussions/topics/17000022987
But after creating new objects and trying to save, nothing is getting written into the document, I'm not getting any error messages either.
Following the code in the thread I mentioned can anyone provide an example of how to correctly use "out-royalserverdocument"?
Thanks in advance.