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
With some notifications like ContentMovedToRecycleBinNotification and ContentDeletedNotification the return type is IContent, not IPublishedContent like the notifications from ContentUnpublishedNotification and ContentPublishedNotification.
When extracting the values from IPublishedContent it's fairly straight forward, but when trying to do the same for IContent I often end up with paths to related documents like umb://document/b7b20e1fe0b14f79866e42dc24b9cc8f, instead of the document itself or in another example where I have a toggle/boolean, which in the IContent object simply has information about the property, but not the actual value of the property.
How do I get to my values in IContent? Or do I have to do something different to work around it and avoid IContent altogether?
have you tried something like this?
or maybe try to inject the Umbraco helper and use the Enity.Id to get the IPublished content.
This one may not work for ContentDeletedNotification as the item will not exist anymore
public class Testing : INotificationHandler<ContentMovedToRecycleBinNotification>
private readonly UmbracoHelper _umbracoHelper;
public Testing (IHttpContextAccessor contextAccessor)
if (contextAccessor.HttpContext == null) throw new NullReferenceException("Can not get umbraco context");
_umbracoHelper = contextAccessor.HttpContext.RequestServices.GetRequiredService<UmbracoHelper>();
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted