Hello
I have a working solution for this on DotNetNuke 4.x, but this does not work any more in DotNetNuke 5.x.
What I am trying to accomplish is to make a new Tab based on a template Tab. then I want to change the permissions, names and parent for this new Tab.
Does anyone have a code example I can work out from?
I found a nice one for DNN prior to version 5, the one I used as a startingpoint the last time:
http://kemmis.info/blog/archive/2007/11/07/programmatically-creating-dotnetnuke-pages.aspx
Here is some code that does not work:
TabController controller = new TabController();
int tabId = -1;
TabCollection tabs = controller.GetTabsByPortal(myPortalID);
foreach (KeyValuePair<int, TabInfo> pair in tabs)
{
TabInfo myTab = pair.Value;
if (myTab.TabID == myTemplatePageID)
{
TabInfo tab = new TabInfo();
tab.TabName = publishItem.Name;
tabId = controller.AddTab(tab);
controller.CopyTab(publishItem.PortalID, myTab.TabID, tabId, false);
tab.PortalID = publishItem.PortalID;
tab.TabName = publishItem.Name;
tab.Title = publishItem.Name;
tab.Description = publishItem.Name;
tab.IsVisible = true;
tab.TabPermissions.Clear();
foreach (TabPermissionInfo info in permissions)
{
tab.TabPermissions.Add(info, false);
}
tab.ParentId = (int) parentTabID;
TabController.CopyPermissionsToChildren(tab, permissions);
controller.UpdateTab(tab);
break;
}
}
Any help appreciated.
Best regards
Vidar