I have some pages created in a structure group in one publication. I want to unpublish all those published pages using core services. Can anyone help me out?
2 Answers
You can use the .UnPublish method of the CoreService client, passing it the URI of the StructureGroup you wish to unpublish the Pages from. This is what the CoreService API reference (well worth a read...) says:
Un-publishes the collection of IdentifiableObjectData instances from given target(s).
IEnumerable<PublishTransactionData> UnPublish(
IEnumerable<string> ids,
UnPublishInstructionData unPublishInstruction,
IEnumerable<string> targets,
Nullable<PublishPriority> priority,
ReadOptions readOptions
)
Parameters
ids
Type: System.Collections.Generic.IEnumerable<String>
Collection of identifiers of the items to unpublish (TCM URI or WebDav URL).
unPublishInstruction
Type: Tridion.ContentManager.Data.Publishing.UnPublishInstructionData
The instruction for the un-publish action.
targets
Type: System.Collections.Generic.IEnumerable<String>
A collection of target identifiers representing Publication Targets or Target Types to un-publish from. This cannot contain a combination of both.
priority
Type: System.Nullable<PublishPriority>
The priority of the un-publish action. Passing null will use the priority from the Publication Target.
readOptions
Type: Tridion.ContentManager.CoreService.ReadOptions
Specifies how the Publish Transaction(s) are read back after un-publishing. If the parameter is null, the items are read with None.
Return Value
A collection of PublishTransactionData

- 2,802
- 14
- 20
-
See http://blog.building-blocks.com/publishing-components-using-the-core-service-in-sdl-tridion-2011 - you create it like the PublishInstructionData object is created in that example, only you don't need a RenderInstruction. – Jeremy Grand-Scrutton Aug 23 '12 at 08:21
I don't have a copy/paste snippet for you, but it should not be very difficult given Jeremy's excerpt from the API documentation of the relevant method and these example that publish items:
- http://blog.building-blocks.com/publishing-components-using-the-core-service-in-sdl-tridion-2011
- http://blog.building-blocks.com/sdl-tridion-2011-component-publisher
- Unable to get Core Service client working
Keep in mind that Stack Overflow works best if you first do some of the work yourself and then show us where you're stuck.

- 1
- 1

- 565,676
- 79
- 828
- 807