You need to inject your code in publishing related pipeline e.g. publish:end
pipeline
- Create Handler, write your code in it
- 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:
Article to refer for detail: https://joaoneto.blog/publishing-service-bulkpublishingend-pipeline/
Refer these dll to your solution
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>
- 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.