1

We have installed sitecore publishing service module to separate publishing. Earlier we were using publish:itemProcessedevent to get all publishing items but with Sitecore Publish module this event is not working.

Could some one please help us here.

1
  • you can get these details from web index if you are looking to get all published items Commented Sep 9, 2022 at 22:49

1 Answer 1

2

You need to inject your code in publishing related pipeline e.g. publish:end pipeline

  1. Create Handler, write your code in it
  2. Refer handler in config at publish:end event
<event name="publish:end">
    <handler type="namespace.classname, assembly" method="methodname" />
</event>

you can refer :
https://briancaos.wordpress.com/2018/01/04/sitecore-publishend-and-publishendremote/

It should solve your problem. As we also use publishing service and it works for us.

Answer updated on 27-sept-2022 :

I have installed publishing service on my local and Details to get all items which get published from service are given below:

  1. Article to refer for detail: https://joaoneto.blog/publishing-service-bulkpublishingend-pipeline/

  2. Refer these dll to your solution

  3. We need to hook into the publishEndResultBatch pipeline a. Add class and enter code to work with published item, e.g.

    public class PublishItemsDetail {

     public void Process(PublishEndResultBatchArgs args)
     {
         if (args.Aborted)
         {
             ActionForAbort(args);
         }
         else
         {
             ActionAfterPublish(args);
         }
    
     }
     private void ActionAfterPublish(PublishEndResultBatchArgs args)
     {
         var itemsAffected = args.Batch.Select(b => b.EntityId).Distinct().ToList();
         foreach (var item in itemsAffected)
         {
             //here you got list of all items published, now do whatever you want with this info
             Console.WriteLine(item.ToString());
         }
    
     }
     private void ActionForAbort(PublishEndResultBatchArgs args)
     {
         Console.WriteLine("aborted publishing...");
     }
    

    }

b. add entry to config

<sitecore>
    <pipelines>
      <publishEndResultBatch>
        <processor type="Nuveen.Utils.Pipelines.PublishItemsDetail, Nuveen.Utils"
                   patch:after="*[@type='Sitecore.Publishing.Service.Pipelines.BulkPublishingEnd.RaiseRemoteEvents, Sitecore.Publishing.Service']" >
         </processor>
      </publishEndResultBatch>
    </pipelines>
</sitecore>
  1. Now you are all set, i have tested it on my local and it works as expected and able to get list of all published items using publish service.
10
  • Are you getting all the related items when you use publish:end event?
    – Reddy
    Commented Sep 9, 2022 at 6:41
  • No, we refer it one by one for each item, to get all, you can refer : sitecore.stackexchange.com/questions/3813/… , see if it works for you
    – Rinku Jain
    Commented Sep 9, 2022 at 6:47
  • If we select related items from publishing dialogue box, we are getting parent items only in code but we are not getting related media and drop link items
    – Reddy
    Commented Sep 9, 2022 at 6:48
  • You want me to refer Glorfindel comments ?
    – Reddy
    Commented Sep 9, 2022 at 6:51
  • please tell which author comment i need to refer
    – Reddy
    Commented Sep 9, 2022 at 8:02

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.