¿Cómo eliminar elementos de la publicación con Tridion Resolver?

I am trying to do implement a custom resolver for a component as described here by Chris: http://www.tridiondeveloper.com/the-story-of-sdl-tridion-2011-custom-resolver-and-the-allowwriteoperationsintemplates-attribute

I want to remove some of the binaries (mostly pdf's) used in component and prevent them from publishing. I am able to get the list of used items using item.GetListUsedItems method. How do I remove them?

using : tridion 2009

preguntado el 31 de julio de 12 a las 13:07

¿Podríamos interesarle en comprometerse con el Propuesta específica del Área 51 Tridion. Regístrese con la misma cuenta SO si tiene un momento. -

2 Respuestas

At Publishing time the resolver process determines which items should be published, like when you publish a Structure Group, the default Resolver will add all Pages in the Structure Group to the Publish Transaction.

Resolvers only deal with items in the Publish Transaction which are directly Publishable, and those are Pages and Dynamic Component Presentations. So a Resolver is not handling the linked Multimedia Components, those are Published by the Template code through calling the AddBinary() método.

If you want to remove Multimedia Components from your Publish action, you should look into the Component Template which is handling those (if they are added to the Package, the Default Finish Action TBB normally picks them up and Publishes them). But keep in mind, a Multimedia Component needs to be Published at least once else you will never get it on your presentation server.

Respondido 01 ago 12, 08:08

+1 for pointing out the difference, @Bart. Frank van Puffelen diagrams the two approaches (implícitamente via template code/AddBinary() y explícito via a multimedia publish and dynamic component templates) on TridionMundo. - alvin reyes

Check the below code snippet to remove, you need to check whether the Multimedia is pdf or not but will get you going. Here is reference link very well explained with sample code as well (code below is from the same article).


       Component component = (Component)item;
        if (component.ComponentType == ComponentType.Multimedia)
            foreach (ResolvedItem resolvedItem in originalResolveItemList)
                if (resolvedItem.Item.Id != item.Id)
                    resolvedItems.Remove(resolvedItem); // to remove ..

Respondido 31 Jul 12, 14:07

I think the resolveditems list has components. I am trying to remove the binary item inside the component - user1373140

How are you publishing the binary inside the Component? Is it via DWT code? If it is via DWT, then why do you want to remove the binary using the resolver since you will end up with broken binary link. If you are publishing the binary the above code will suffice your needs with check condition for ComponentType.Multimedia - carnero g

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.