Is it possible to catch if an action is Publish or UnPublish in the SetPublishStateEventArgs?
I see in this postthis post I can use the PublishOrUnPublishEventArgs.
Here is the code:
public MyEventSystem()
{
EventSystem.Subscribe<RepositoryLocalObject, SetPublishStateEventArgs>(GetPublishInfo, EventPhases.TransactionCommitted);
}
private void GetPublishInfo(RepositoryLocalObject subject, SetPublishStateEventArgs args, EventPhases phase)
{
foreach (var item in args.ProcessedItems)
{
string title = subject.Title;
string publicationTarget = args.Target.Title;
}
}