I am trying to delete a Publication that is no longer required.
Any localized items within the Publication have been unlocalized, and the Publication has also been unpublished.
When I try and delete the Publication from the CME, I am getting the following error message:
(80040332) It is not possible to delete a Publication that contains published items. Unable to delete Publication (tcm:0-24-1).
Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation) Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Delete(TcmUri) Tridion.ContentManager.IdentifiableObject.Delete(DeleteEventArgs) Tridion.ContentManager.IdentifiableObject.Delete() Tridion.ContentManager.BLFacade.IdentifiableObjectFacade.Delete(UserContext,String) Publication.Delete
Checking in the database, the following query doesn't return any rows.
SELECT ID, PUBLICATION_TARGET_ID, PUBLICATION_ID, ITEM_REFERENCE_ID, STATE, STATE_CHANGE_DATE, TRUSTEE_ID, COMPONENT_TEMPLATE_REF_ID
FROM ITEM_STATES
WHERE (PUBLICATION_ID = 24) AND (STATE <> 0)
This says to me that everything for this Publication has been unpublished, so I can't see why I am getting this error and am unable to delete the Publication?
I can't see anywhere a list of items that the CME thinks are published in this Publication. Is it possible to get a list somehow, although according the database, there aren't any!
Any ideas?
PUBLISH_STATES
table too.ITEM_STATES
andPUBLISH_STATES
table, but its better to use the TOM API as @robrtc mentions in his answer.