4

I have a scenario like component must be unpublished when the expiration date meet. am using core service to do that.

Suppose when a component published with template A & B, When I tried to un-publish the component by core service its un-publishing only last published .Means it’s un-publishing only the component with Template B. I want to un-publish completely with all templates it got published. Is there any way using core service?

sample code used:

ComponentData cData = csClient.Read("idhere", new ReadOptions()) as ComponentData;              
           PublishInfoData[] pubdatas = csClient.GetListPublishInfo(cData.Id);
           List<string> targets=new List<string>();
            UnPublishInstructionData unpubInstruction = new UnPublishInstructionData()
            {
                ResolveInstruction = new ResolveInstructionData()
                {
                    IncludeChildPublications = false,
                    Purpose = ResolvePurpose.UnPublish,
                },
                RollbackOnFailure = true          

            };
            foreach (PublishInfoData pdi in pubdatas)
            {
               targets.Add(pdi.PublicationTarget.IdRef);
               string repo= pdi.Repository.IdRef;

            }
            csClient.UnPublish(new string[] { cData.Id }, unpubInstruction, targets.ToArray(), PublishPriority.Normal, new ReadOptions()); 

with addition to that FYI we are using deployer extension. i have found only one argument in instruction.XML when doing un-publish in the transport package

Action

Undeploy

Action

Arguments

ComponentPresentation ComponentId="cmpidhere" TemplateId="tempidhere"

Arguments

is this expected behavior ? my thought is it should have two with different template id. am i correct ?. if so is there any way i can correct this ?.

  • 2
    Hi Swami and welcome to Tridion Stack Exchange! Could you share your code for feedback and answers from the community? Unpublishing a Component should unpublish its dynamic Component Presentations (DCPs) and Pages that reference it (embedded statically). – Alvin Reyes Nov 18 '15 at 21:18
  • 1
    As Alvin highlighted, it will definitely help if you post a code snippet, Tridion version etc. Do you also observe the "above" behavior when you are using the CME to unpublish? – Shiva Nov 19 '15 at 3:23
  • Thank you @Alvin,@Siva. please find the code used by me to unpublish – swami Nov 19 '15 at 17:41
  • If you select the same Component in the Tridion GUI to UnPublish, then click the 'See items to UnPublish' button in the Publish Dialog, what do you see? Also, if you UnPublish the Component from the GUI, do both Component Presentations get UnPublished? I would assume the GUI uses the same or similar code as the Core Service does when UnPublishing.... – robrtc Nov 25 '15 at 18:43
2

@Alvin, You are correct. After digging in to our customization stuff I have found problem with our custom resolver. Thanks for your input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.