MenuItem navigate to custom route to export all childnodes
I wanted to create a MenuItem in Umbraco to export all child nodes of the current node without going through the default view. Unfortunately, by setting AdditionalData actionView to the route of my controller, the system doesn't work. Also, by setting NavigateToRoute to the route of my Umbraco controller, it redirects me to the login page. Here's the example code I used:
public class ExportMenuRenderingNotification : INotificationHandler<MenuRenderingNotification>
{
public ExportMenuRenderingNotification() { }
public void Handle(MenuRenderingNotification notification)
{
if (notification.TreeAlias.Equals(Umbraco.Cms.Core.Constants.Conventions.PermissionCategories.ContentCategory))
{
// Creates a menu action that will open /umbraco/currentSection/itemAlias.html
var menuItem = new Umbraco.Cms.Core.Models.Trees.MenuItem("exportChildnodes", "Export");
//menuItem.AdditionalData.Add("actionView", "~/umbraco/BackOffice/Api/Export/ExportChildNodes/"+notification.NodeId);
menuItem.NavigateToRoute("~/umbraco/BackOffice/Api/Export/ExportChildNodes/"+notification.NodeId);
// sets the icon to icon-wine-glass
menuItem.Icon = "reply-arrow";
notification.Menu.Items.Add(menuItem);
}
}
}
MenuItem navigate to custom route to export all childnodes
I wanted to create a MenuItem in Umbraco to export all child nodes of the current node without going through the default view. Unfortunately, by setting AdditionalData actionView to the route of my controller, the system doesn't work. Also, by setting NavigateToRoute to the route of my Umbraco controller, it redirects me to the login page. Here's the example code I used:
Can someone help me?
Thanks a lot
Damiano
is working on a reply...