dotnetnukedotnetnuke-9

Can you access a Modules Quick Settings from a Scheduled Task


Can you access a Modules Quick Settings from a scheduled task (class implementing SchedulerClient)? OR is there a way to select which Module you would like to retrieve the ModuleSettings for?

for example:

ActiveModule.ModuleSettings[FeatureController.SETTING_URL]

Solution

  • You can get the module settings with the ModuleController.

    using DotNetNuke.Entities.Modules;
    
    //get the module settings with the correct ModuleId and TabId
    ModuleInfo mi = ModuleController.Instance.GetModule(ModuleId, TabId, false);
    
    //change some settings
    mi.ModuleTitle = "New Module Title";
    
    //save the new module settings
    ModuleController.Instance.UpdateModule(mi);
    

    UPDATE

    You can get all the Tabs or Modules like this

    //get all tabs in the portal
    var tabs = TabController.GetPortalTabs(PortalId, 0, true, false);
    
    //get all modules in the portal
    var modules = ModuleController.Instance.GetModules(PortalId);
    
    //loop all individual modules
    foreach (ModuleInfo module in modules)
    {
         Label1.Text += module.ModuleTitle + "<br>";
    }