I am moving some documents programmatically, and find that although the documents have been moved, their urls are not updated. I have tried republishing everything, unpublish / publish programmatically. The only thing that seems to work is unpublish / republish via. the umbraco backend. Does anybody have a solution to this problem ?
Moving a document, and getting an updated niceurl
I am moving some documents programmatically, and find that although the documents have been moved, their urls are not updated. I have tried republishing everything, unpublish / publish programmatically. The only thing that seems to work is unpublish / republish via. the umbraco backend. Does anybody have a solution to this problem ?
You tried calling the Page_Load() Event after publishing?
Actually this seems to do the trick :
library.UpdateDocumentCache(document.Id);
if (document.Published)
{
document.UnPublish();
library.UnPublishSingleNode(document.Id);
sender.PublishWithResult(document.User);
}
So you're unpublishing the document and then republishing it?
Will that not have a fair overhead if multiple users are publishing documents?
Well, yes. And if there is another way to get your niceurl updated programmatically after it has been moved I would love to hear about it.
Not sure you need to unpublish. I may be wrong but I think you could move it and then just publish it
Maybe not but might be worth a try
That is not enough. It seems to be this line than made it work :
library.UnPublishSingleNode(document.Id); ( which I found in the unpublish event handler of the editContent.aspx form using reflector. )
It is just too bad this issue is not handled inside the move method.
Ok that's good to know :)
is working on a reply...