I am trying to build a custom publishing pipeline in SC 9.3 where I need to do some custom operations on the items being currently published.
I created a custom pipeline and the code looks like below:
public class MyProcessor : PublishItemProcessor
{
public override void Process(PublishItemContext context)
{
if (context == null || context.Aborted)
{
return;
}
var item = Sitecore.Context.Item;
Item sourceItem = context.PublishHelper.GetSourceItem(context.ItemId);
Item targetItem = context.PublishHelper.GetTargetItem(context.ItemId);
...
}
}
Unfortunately, I ran out of ideas on how to get the currently published item ID inside this pipeline. In the code above the item is null, and the sourceItem and targetItem return the language of the content, not the actual item that I am publishing.
Could you please help and point me out to the best way how to check which item is being published?