I need to get list of items that were published but I don't know where to get it...

I created publish:end handler

public void OnPubEnd(object sender, EventArgs args)
            var sitecoreEventArgs = ((SitecoreEventArgs) args);
            var item = Event.ExtractParameter(args, 0);

but it is no data about it in SitecoreEventArgs


5 Answers 5


The publish:end event will be triggered once at the end when all items have been published and therefore does not contain the list of all the items. If you are interested in collect information about the item you published you need to implement a handler in the publish:itemProcessed

 <event name="publish:itemProcessed">
   type="My.Assembly.Namespace.ItemProcessedProcessor, My.Assembly"

This is your code for the processor:

using System;
using Sitecore.Data;
using Sitecore.Publishing.Pipelines.PublishItem;

namespace My.Assembly.Namespace
  public class ItemProcessedProcessor

    public void ItemProcessed(object sender, EventArgs args)
        ItemProcessedEventArgs itemProcessedEventArgs = args as ItemProcessedEventArgs;
        PublishItemContext context = itemProcessedEventArgs != null ? itemProcessedEventArgs.Context : null;

        // your logic here


This is (Very!) late, but just thought of sharing the solution that worked for me here as this article ranks top in search.

If you are looking for handling one item at a time during publish, you can just hook your handler to publish:itemProcessed event as described in Vlad's solution. If you will be needing to work on the entire list of published items all at once, you could leverage the ProcessedPublishingCandidates property. This is available in the Publish Context, which means it is accessible from the PublishItem pipeline (responsible for publishing individual item from publish queue) and Publish pipeline as well. You could just intercept the Publish pipeline after ProcessQueue step to get hold of the entire list of published items.

If you are looking for gathering more details specific to items and then handling them all at once, you could use 'CustomData' property which is part of Publish Context to store the custom data in PublishItem pipeline and process them at once from Publish pipeline.

class CustomPublishProcessor : PublishProcessor
    public override void Process(PublishContext context)
        Assert.ArgumentNotNull(context, "context");
        if (context.Aborted)
        //Fetches List of Processed(Created/Updated/Deleted) Items
        var processedItems = context.ProcessedPublishingCandidates.Keys
            .Select(i => context.PublishOptions.TargetDatabase.GetItem(i.ItemId)).Where(j => j != null);

        //Fetches List of Deleted Items
        var deletedItems = context.DeleteCandidates;

Here is the configuration to register the processor,

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor patch:after="*[@type='Sitecore.Publishing.Pipelines.Publish.ProcessQueue, Sitecore.Kernel']" type="Assembly.Pipelines.CustomPublishProcessor, Assembly"/>

For more information, see my blog article.

  • I exactly wanted this but I need to clear cache on publish, so will it clear cache of CD servers?
    – Imad
    Jan 28, 2022 at 14:42

Sitecore publishing log is way more complete and durable, but if you don't have a processor logging this for you -- in a pinch -- I've made use of this SQL query to the EventQueue to get a handle on what's been recently published:

SELECT Created as [Publish Timestamp]
            , Username as [Initiator]
            , CAST(SUBSTRING(HASHBYTES('SHA1', UserName),1,3) as bigint)  as [Hashed Initiator]
            , IIF(CHARINDEX('"TargetDatabaseName":"web"', InstanceData)>0,'1','0') AS [To web]
            , IIF(CHARINDEX('"TargetDatabaseName":"ProdRegion1web"', InstanceData)>0,'1','0') AS [To Region1]
            , IIF(CHARINDEX('"TargetDatabaseName":"ProdRegion2web"', InstanceData)>0,'1','0') AS [To Region2]
            , IIF(CHARINDEX('"TargetDatabaseName":"ProdRegion3web"', InstanceData)>0,'1','0') AS [To Region3]
            , (LEN(InstanceData) - LEN(REPLACE(InstanceData, '"LanguageName"', ''))) / LEN('"LanguageName"') as [# of Langs] --this is an ugly proxy for how heavy a publish is
            , InstanceData AS [Raw Data]
        FROM EventQueue
        WHERE EventType LIKE 'Sitecore.Publishing.StartPublishingRemoteEvent%'
        ORDER BY Created DESC

Depending on your EventQueue data retention rules, this may or may not be useful.


As an example for quick solution you can use publish:itemProcessed but you can operate only with one item per time. In this case you need to develop your custom storage and accumulate published items and clean it up by some criteria.


You can patch up your logic in 'Publish' Pipeline to get the items published. Also get 'lastpublished date' & compare it with published items to fetch the new items that are published.

Please take care of

  1. Your sitecore version as publishing feature in 8.2 started using publishing service, if 8.2 i think you might change your approach on this.
  2. I would recommend to make publish light weight & think about someother alternates to achieve this if possible. As you might be aware 'publish' is the long time process & we have to think before extending it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.