In a publish pipeline processor, in order to get an item on which publishing is performed (the root item), you can use
PublishContext and it's
The class should be inherited from
Note: You can get
"Publish Item" operation is used, but the property will be
"Publish Site" is triggered.
The following example shows how to get publishing
RootItem in a publishing pipeline processor:
public class YourPublishProcessor : PublishProcessor
public override void Process(PublishContext context)
//this is the item on which "Publish item" operation was triggered
Item rootItem = context.PublishOptions.RootItem;
You can also find a bit more information in this blog post.
RootItem will be available regardless of what publishing options are selected (smart publish/ republish or publish related items or publish subitems), but only available when
"Publish Item" is triggered.