I am performing some logic after successful publishing of each page on Live target and hence I have subscribed to the following event:
EventSystem.SubscribeAsync<PublishTransaction, SetPublishStateEventArgs>( CustomLogic, EventPhases.TransactionCommitted);
My custom logic works well but now I want to change the logic based on the Published/Republished state of the page.
I tried getting the ResolvePurpose using following:
But it’s only giving the Publish or Unpublish state but not Republish.
The other option is to change the event Phase to
EventPhases.Initiated, and I make a check if
page.IsPublishedInContext but that too will always return true even if the page is Published to Staging and also my custom logic I believe will always gets invoked even if the Publishing fails which I don’t want.
Any help would be appreciated.
Thanks in advance.