I want to update a document property after the page is published with a value from a 3rd party web service.
When I use contentService.SaveAndPublishWithStatus i end up in an infinite loop.
When I use contentService.Save(node, 0); it works fine but then the page is flagged as having unpublished changes and is greyed out to the user which is confusing for them.
How can I set a property value, publish the page and not end up in an infinite loop?
private void ContentServicePublished(IPublishingStrategy sender, PublishEventArgs<IContent> args, UmbracoHelper helper)
{
foreach (var node in args.PublishedEntities)
{
if (node.ContentType.Alias == "mGProperty")
{
string retVal = AppLib.sendPropLinkUmbraco(node.Id, "publish");
node.SetValue("advertRef", retVal);
//contentService.SaveAndPublishWithStatus(node,0, false);
contentService.Save(node, 0);
}
}
}
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/93663-updating-a-property-using-contentservicepublished