问题
I am using Tridion R5.3. I am trying to delete a component in but it it showing as published. No matter what I do I cannot get it to unpublish. I ran the following query against the database to determine where the component is published.
SELECT *
FROM [dbo].[PUBLISH_STATES] WITH (NOLOCK)
WHERE REFERENCE_ID = 268494
And I received the following information
- ID : 45173
- REFERENCE_ID : 268494
- ITEM_TYPE : 16
- PUBLICATION_ID : 4
- STATE : 1
- STATE_CHANGE_DATE : 2006-08-18 12:50:25.597
- PUBLICATION_TARGET_ID : 2
- TRUSTEE_ID : 43
- TEMPLATE_REFERENCE_ID : 89798
- TEMPLATE_ITEM_TYPE : 32
I have tried to unpublish the component from the publication target with an ID of 2 but no luck.
Would I be safe to just delete the row in the database?
Update
On the suggestion of Nuno and after reading another question I figure I have to un-publish the associated component template. I have tried the following and I am getting a Type Mismatch
when executing the SetPublishedTo()
method.
TDS.TDSE tdse = new TDS.TDSE();
var componentTemplate = (TDS.ComponentTemplate)tdse.GetObject("tcm:4-89798-32", TDSDefines.EnumOpenMode.OpenModeView);
componentTemplate.SetPublishedTo("tcm:4-268494", "tcm:0-2-65537", false, tdse.User);
回答1:
After contacting SDL Support the solution was to set the STATE
field to 0
in both the ITEM_STATES
and PUBLISH_STATES
tables for the relevant component.
UPDATE dbo.ITEM_STATES
SET STATE = 0
WHERE ITEM_REFERENCE_ID = 268494
UPDATE dbo.PUBLISH_STATES
SET STATE = 0
WHERE REFERENCE_ID = 268494
来源:https://stackoverflow.com/questions/13685283/cannot-unpublish-component