Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
What is the official way in the Umbraco API to determine what changed during publication of a content item from the previous time it was published?
For example, my content item has a RTE body text property, and I would like to know if it changed and how (i.e. before and after state so that I can perform my own comparison on the delta/differences).
There is a method called IsPropertyDirty() that can be called to check if a property has changed. I know of nothing that can get you the original value, but you could roll your own code to do this
public class Register : ApplicationEventHandler
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
ContentService.Published += ContentService_Published;
private void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<IContent> e)
foreach (var newContent in e.PublishedEntities.Where(x => x.IsPropertyDirty("bodyText"))
var originalContent = Umbraco.Web.UmbracoContext.Current.ContentCache.GetById(newContent.Id);
// now compare newContent.GetValue("bodyText") vs originalContent.GetPropertyValue("bodyText")
great thank you. btw I think you meant the ContentService.Publishing rather than ContentService.Published event.
You are correct, you did specify publishing event. I was lazy and copied my code from a Published event, strangely I do also have a publishing event I could have used, but for some reason ignored it, because it was bigger.
Oh well, I'm sure you can amend accordingly.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted