Using Umbraco 6.1.3. I am trying to use the Published EventHandler to update an external file based on the content published. I am able grab property values from the content and write to this external file, but I need to get the url of the published page as well. To do this, I am using:
private void UpdateTableFileEventHandler(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs e)
{
foreach (var item in e.PublishedEntities)
{
UmbracoHelper UMHelper = new UmbracoHelper(UmbracoContext.Current);
IPublishedContent publishedContent = UMHelper.TypedContent(item.Id);
}
}
This works, as long as the document has been published before, but if it is a new document, apparently it isn't in the cache yet because I get a null reference. Anyone know how to grab the url of a newly published item? I only see 'Publishing' and 'Published' as options and I've tried both. What am I doing wrong?