How to change the Published state of all items in Publication to "unpublished" to delete the Publication using Core Service.
There is no way to set individual items as unpublished from the Core Service.
If you have access to the items and the Publishing Target is still set up then you may want to delete these manually or write a Core Service script to find all items published to that Target in that Publication and unpublish them.
If you're looking to delete all items published to a particular Publication Target (across all Publications), then you could use the Core Service to decommission the Target completely using the
DecommissionPublicationTarget method. More details here: Decommissioning a Publication Target. (There is also a
Clear-TcmPublicationTarget PowerShell script for this.)
If unpublishing from the Target is no longer an option (e.g. If the Target has been deleted or is somehow corrupted) then you're probably going to need a database script. If you're working in your Production environment then you'll want to talk to SDL Support about this. If it's just a local test environment, then you might want to look at the
STATE column in the
PUBLISH_STATES table in the Content Manager database**
** It's not recommended to update the Content Manager database directly without the approval of SDL Support, as this may invalidate your support agreement. Please also make sure to backup your CM database first
As mentioned by Jonathan, there is no way to force the published state of an item to a specific value. The published states are automatically updated once the relevant Publish Transaction reaches a final state, ie:
warning. There are two parts of the system and if you forcibly change only one side (the published state on the CM side), then you artificially introduce an inconsistency (the actual published content on the CD side).
You say in your comment that the only reason for wanting to force the state is because the transactions got stuck in the queue, so the focus of your attention should be "why are the items stuck?". Is the queue full of items? If yes, try sending them on high priority, naturally, consult other users of the system so you don't block them. Or is the publishing pipeline stuck? If yes, try and discover at which point: rendering, transporting, deploying, and remedy the problem.