2

I wrote code to delete the Publish page using Core Service befor deleting the page i wrote the code to UnPublish the page after this i wrote the code to delete the page but i an getting the exception when delete method call

"

com.sdltridion.contentmanager.coreservice.ICoreServiceDeleteCoreServiceFaultFaultFaultMessage: The item is published. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source) at com.sun.proxy.$Proxy77.delete(Unknown Source)

"

Following is my code

           ArrayOfstring targeturi=new ArrayOfstring();
           List<String> lt=targeturi.getString();
           lt.add("tcm:0-8-65538");
           UnPublishInstructionData unPublishInstructionData=new UnPublishInstructionData();

     unPublishInstructionData.setResolveInstruction(new ResolveInstructionData());

     ArrayOfstring id=new ArrayOfstring();
               List<String> stringTcm=id.getString();
                stringTcm.add("tcm:355-80214-64");
             ArrayOfPublishTransactionData aopt= client.unPublish(id, unPublishInstructionData, targeturi,PublishPriority.NORMAL, new ReadOptions());
               client.delete("tcm:355-80214-64");
  • 1
    Can you update the grammar in your question with some punctuation? It's very hard to understand what you're saying without periods or commas. – Nickoli Roussakov Sep 24 '14 at 22:42
3

Deleting is always an issue with code in SDL Tridion. There could be many possibilities in which case your code will fail:

  • (As somewhat suggested by Hiren) You call the unpublish method and the choose to un-publish it from all the Publication targets and you call the delete before it actually got publish from all the Publishing targets and you can never determine the actual time taken to unpublish it from all Publishing target - You may choose to write some code to poll and identify whether the page has been successfully published from ALL the publishing target before deleting the page
  • The unpublishing of page got failed on one or more publishing target - Your code won;t be able to delete unless you rectify the unpublishing failure
  • Earlier you have publishing the page to a Publishing Target and then renamed the publishing target - The unpublishing won't remove its references from the Tridion DBs and you won't be able to delete unless you rectify the conflict
  • You have restore Tridion DB from some other environment (Say from PROD to UAT or DEV) - Unpublishing might not nullify all references and thereby won't let you delete unless you rectify all references
  • The page is checkout while you are executing your code - You may add a code to Checkin the page before you unpublish and delete to take care of this scenario
| improve this answer | |
1

When you execute unpublish from coreservice that transaction goes to publishing queue for unpublish however page is not unpublished immediately. So page is not unpublished by the time you invoke client.delete method.

One probable way could be, to add delay of 1 minute between unpublish and delete.

| improve this answer | |
  • What if at the time of code execution there are many items already waiting for publishing in the Publishing queue or along side someone publish few items with High Pririoty? – Pankaj Gaur Sep 24 '14 at 6:55
  • @PankajGaur That is case by case, so that is why I said one probable way. The person working in the situation will have more idea on what all things are transpiring at their end. – Hiren Kaku Sep 24 '14 at 17:09

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.