Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tridion 2011 - Publish Unpublish while writing custom resolver

Needed to understand your inputs on: Is there a way in Tridion 2011 to Publish or Unpublish components/pages/templates in a custom resolver code. I understand we can play with the list of resolved items. (By giving a CP,etc). But is there a way to push an item in the publishing Q from a custom resolver code.

like image 692
Rohan Gadiya Avatar asked Oct 30 '12 16:10

Rohan Gadiya


2 Answers

You can add or remove any number of items to be part of the existing package / transaction.

If you want it to be part of a new entry in the Publishing Queue instead, the event system seems more appropriate than a resolver. But the items you are publishing automatically won't show up in the "Items to Publish" screen if you Publish them separately, so you need to decide if that's a good thing or not.

like image 174
Peter Kjaer Avatar answered Oct 20 '22 02:10

Peter Kjaer


Peter (and Nuno) have really answered your question in the best way. You should use a resolver to add the Pages or Component Presentations to the package rather than making new publish transactions. However you can publish items using the core service, so there is no reason you could not call the core service from a resolver and initiate your new publish actions that way.

However it does not sound like a good idea, perhaps you can update you question to explain why you need to do this.

I used to use the PublishEngine object in my templates to add items to the Publish Queue (see http://www.tridiondeveloper.com/the-story-of-sdl-tridion-2011-custom-resolver-and-the-allowwriteoperationsintemplates-attribute), but custom resolvers and other techniques are far superior.

like image 24
Chris Summers Avatar answered Oct 20 '22 01:10

Chris Summers