I need to automate an xml page publishing twice every week using Tridion 2009 SP1. As per my discussion with the SDL support team, there is no out of box feature available. Also I have seen a solution here for 2011 but not 2009 SP1. Can you please help me with some pointers for setting up autopublishing ?
-
Publishing automatically isn't out of the box, but you can schedule publish requests. Other approaches could be considering if you have regular CMS actions that should trigger the update, which might suggest the event system, or if you'd want to future schedule multiple dates easily (the 2009 equivalent to a GUI extension aka custom page).– Alvin ReyesMar 6, 2013 at 3:09
2 Answers
As you have discovered, there is no way to do this out of the box. The simplest way to do this is to write a small script with powershell or .net which calls the publish action using TOM via Interop, and schedule it with the Windows Task Scheduler on you CMS or Publishing server. You could also write a windows service, but that may be overkill for this.
If you migrate to 2011 or 2013 you would do well to use Core Service rather than TOM.
-
Thanks for the quick response Chris. In our application, we are using only Java based programming. So is there a way to script this publish action using Java programming instead of .net and trigger it with Windows Task Scheduler ? Feb 15, 2013 at 18:44
-
Not really, unless you use the soon to be obsolete Business Connector (but that would be a tough learning curve if you don't already use it) As there is no Core Service for 2009. It should only be about 5 lines of code though. Let me know if you need a VBScript or C# sample. Feb 15, 2013 at 19:26
-
It would really be helpful if you can share the samples with us so that we can modify accordingly and see how we can fit it into our application. Thank you. Feb 15, 2013 at 21:25
-
It's not clear whether your desire to do this in Java is because you feel this would be a better solution or because you have programmers who are unwilling to code in anything but Java. Can you explain? Feb 18, 2013 at 22:33
A VBScript file to publish a page is really just a couple of lines. I can't test this right now, but using the Tridion Object Model documentation (hint: it's a CHM file) you should be able to fix whatever I missed on this:
Dim pageId, targetId
Dim tdse, page
pageId = "tcm:12-12-64"
targetId = "tcm:0-1-65537"
set tdse = CreateObject("TDS.TDSE")
tdse.initialize()
set page = tdse.GetObject(pageId, 1)
call page.Publish(targetId, false, false, false)
Save this in a .vbs file, which you can execute with cscript filename.vbs
. The user running the script must be a valid Tridion user with enough permissions to publish the page to that target. If you are using LDAP, then the user running the script must be a valid impersonation user, and you need to call tdse.Impersonate(ValidUserName)
after creating the TDSE object.
Also, pageId
and targetId
values should match the TCM Uris of YOUR page and target.