Skip to main content
2 of 2
Marked doc quote as quote and undented the code

Resolve Engine.ResolveItem does not work in Unpublish tridion

I'm trying to capture the resolved items using the Publish Context of my current Publish Transaction.

My code works in case of Publish of a Bundle and all the resolved items for the respective Identifiable object are fetched. But same code fails to capture when it is Unpublish.

This is the code I'm using

List<PublicationTarget> pubTargets = new List<PublicationTarget> { pubTrans.PublishContexts.First().PublicationTarget };
                    
// Gets theTridion ResolvedItems for the Current Component from ResolveInstruction
var resolvedItems = default(Tridion.Collections.ISet<ResolvedItem>);
if (isBundleItem)
{
    var pubContext = ResolveEngine.ResolvePublishContext(publishedObject, pubTrans.Instruction.ResolveInstruction, pubTargets);
    resolvedItems = ResolveEngine.ResolveItem(publishedObject, pubTrans.Instruction.ResolveInstruction, pubContext.First());
}

I'm passing the Publish Transaction through an event.

EventSystem.Subscribe<PublishTransaction, SaveEventArgs>(PublishOnTransactionSaveFinished, EventPhases.TransactionCommitted);

This is what I found in CHM file for TOM.NET API.

ResolveItem Gets a list of ResolvedItem to be (un-/re-)published to given PublishContext if an (un-/re-)publish action is performed on this item.

This suggests that the method should work for both Publish and Unpublish. Please let me know what I'm missing here.