Moving a node after Publishing -> doesn't redirect
Hey i need some Help.
I just wrote an ApplicationEventHandler in c# with a CustomPublishedEventHandler.
If a node is being published, this node will be moved under another node.
Document doc = new Document( nodeId );
doc.Move( otherNode.Id );
This works fine, but when i click "save and publish" in the umbraco backend, the node is being moved, but i need to refresh the backend and redirect to the moved node again.
umbraco.library.RefreshContent(); doesnt work.
Is there any way to redirect over api to the id of the moved node ?
Do you mind sharing the whole code snippet? It might make it easer for people to give you some suggestions about what could be wrong. I can't remember how to do the refresh but I think that umbraco.library.RefreshContent() is obsolete by now since you're using Umbraco 7.
Yeah, I was not able to find it either but if I remember correctly you should be able to use doc.SaveAndPublish(childeNode) instead of umbraco.library.RefreshContent() - But not at dev machine currently so don't have any examples I can test. But found this old blogpost about how to use the content service API - The information is still valid. https://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api/
Moving a node after Publishing -> doesn't redirect
Hey i need some Help. I just wrote an ApplicationEventHandler in c# with a CustomPublishedEventHandler.
If a node is being published, this node will be moved under another node.
Document doc = new Document( nodeId ); doc.Move( otherNode.Id );
This works fine, but when i click "save and publish" in the umbraco backend, the node is being moved, but i need to refresh the backend and redirect to the moved node again.
umbraco.library.RefreshContent(); doesnt work.
Is there any way to redirect over api to the id of the moved node ?
Hope anyone can help me :)
push
Hi Yves
Do you mind sharing the whole code snippet? It might make it easer for people to give you some suggestions about what could be wrong. I can't remember how to do the refresh but I think that umbraco.library.RefreshContent() is obsolete by now since you're using Umbraco 7.
Have you checked the API documentation? https://our.umbraco.org/documentation/Reference/Management/Services/
/Jan
public class GuestbookEntryPublishHandler : ApplicationEventHandler {
}
Yes i checked the API documentation, but didn't find anything helpfully.
Hi Yves
Yeah, I was not able to find it either but if I remember correctly you should be able to use doc.SaveAndPublish(childeNode) instead of umbraco.library.RefreshContent() - But not at dev machine currently so don't have any examples I can test. But found this old blogpost about how to use the content service API - The information is still valid. https://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api/
Hope this helps!
/Jan
Hey, i changed to using content service api, but this didnt fix the problem.
Actually i try to modify the umbraco.ressource.js file.
but i dont know how the get the doc-type-alias by the id.
i want to do something like:
if ( getNodeById(id).DocTypeAlias === "Example") location.reload()
is working on a reply...