Is it possible find all the items published on a given date along with Published user , published Date and time using sitecore powershell ?

  • As far as I know, no. Because Sitecore does not keep track of published items. You can achieved this though using the publish:itemProcessed. You’ll need to implement custom code to write it somewhere for example in file or database then query that table to generate a report. – Hishaam Namooya May 10 at 18:45
  • @HishaamNamooya thanks for the replay , does that mean that is no way to get a list if newly published items ? unless we create a custom class and hook ? – Manohar R.A May 11 at 17:21
  • Yeah that’s right. Once I am connected to my laptop I’ll share the piece of code with more details – Hishaam Namooya May 11 at 20:27
up vote 4 down vote accepted

Currently, OOTB Sitecore does not keep track of published item. However, you can create your own. You can do so by listening the the event publish:itemProcessed. Below is a code snippet which you can use to store those data.

public void OnItemProcessed(object sender, EventArgs args)
{
    var itemArgs = args as ItemProcessedEventArgs;

    if (itemArgs != null)
    {
        var publishContext = itemArgs.Context.PublishContext;

        var processedItems = publishContext.ProcessedItems;

        foreach (var processedItem in processedItems)
        {
            var item = Factory.GetDatabase("master").Items.GetItem(new ID(processedItem));

            if (item != null)
            {
                //The Logic to store details about the item.

                //Code is for retrieving the user who launched the publish
                var username = publishContext.PublishOptions.UserName
            }                
        }
    }
}

You can store the data within a table and then query it to retrieve the data. You can add it on the Sitecore LaunchPad with a filter of the date range. Then you have a method which will generate the report based on the input.

Once you have the piece of code ready, you need to attach it to the event as shown below.

<events timingLevel="custom">
   <event name="publish:itemProcessed">
     <handler type="YourNamespace.ClassName, YourAssembly" method="OnItemProcessed" />
   </event>
</events>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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