Esempio n. 1
0
        public bool DeleteProjectConnector(IDataItem item)
        {
            try
            {
                //get the connector class.  Later we will get the type projection so we can delete related objects.
                //item = ConsoleContextHelper.Instance.GetInstance((Guid)item["$Id$"]);

                //get type projection of the connector (Cireson.ProjectAutomation.ConnectorRelatesToProjects.ProjectionType) (34e516cf-644f-11b7-be02-6c886ec0573b)
                item = ConsoleContextHelper.Instance.GetProjectionInstance((Guid)item["$Id$"], new Guid("34e516cf-644f-11b7-be02-6c886ec0573b"));
                //add in some sort of confirmation on delete... later.
                if (MessageBox.Show(
                        String.Format(ServiceManagerLocalization.GetStringFromManagementPack("strConfirmDelete") + " {0}", item["DisplayName"]),
                        ServiceManagerLocalization.GetStringFromManagementPack("strDeleteConnector"), MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                {
                    return(false);
                }
                var emg          = ConsoleContext.GetConsoleEMG();
                var emoConnector = emg.EntityObjects.GetObject <EnterpriseManagementObject>((Guid)item["$Id$"], ObjectQueryOptions.Default);
                var iddRemove    = new IncrementalDiscoveryData();

                // (Cireson.ProjectAutomation.Library) (System.ProjectConfigItemRelatesToProjectConnector) (da061582-3f6c-d7b7-d17d-0a91b8a51ace)
                ManagementPackRelationship mprConnectorHasProject = emg.EntityTypes.GetRelationshipClass(new Guid("da061582-3f6c-d7b7-d17d-0a91b8a51ace"));

                //remove the related project CIs.
                foreach (EnterpriseManagementRelationshipObject <EnterpriseManagementObject> obj in
                         emg.EntityObjects.GetRelationshipObjectsWhereSource <EnterpriseManagementObject>(emoConnector.Id, mprConnectorHasProject, DerivedClassTraversalDepth.None, TraversalDepth.OneLevel, ObjectQueryOptions.Default))
                {
                    iddRemove.Remove(obj.TargetObject);
                }



                //remove workflow rule for the connector
                try
                {
                    //Cireson Project Server Automation Library Configuration (Cireson.ProjectAutomation.Library.Configuration) (19b2a173-bea9-9e50-0709-1470424916f2)
                    ManagementPack mpConnectorWorkflow = emg.ManagementPacks.GetManagementPack(new Guid("19b2a173-bea9-9e50-0709-1470424916f2"));
                    //Project Server Connector (Cireson.ProjectAutomation.Library) (Microsoft.SystemCenter.Connector.ProjectServer) (d581d2d6-b6cd-b558-7ac7-db233a7c82ec)
                    ManagementPackClass mpcConnector    = emg.EntityTypes.GetClass(new Guid("d581d2d6-b6cd-b558-7ac7-db233a7c82ec"));
                    string             sConnectorRuleId = string.Format("{0}.{1}", "Cireson.ProjectServer.Automation", new Guid(emoConnector[mpcConnector, "Id"].Value.ToString()).ToString("N"));
                    ManagementPackRule mprConnector     = mpConnectorWorkflow.GetRule(sConnectorRuleId);
                    mprConnector.Status = ManagementPackElementStatus.PendingDelete;

                    mpConnectorWorkflow.AcceptChanges();
                }
                catch
                { }

                iddRemove.Remove(emoConnector);
                iddRemove.Commit(emg);
                return(true);
            }
            catch (Exception ex)
            {
                ConsoleContextHelper.Instance.ShowErrorDialog(ex, string.Empty, ConsoleJobExceptionSeverity.Error);
                return(false);
            }
        }
Esempio n. 2
0
        private void UpdateConnectorInstance()
        {
            //Get the server name to connect to and connect
            String strServerName          = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
            EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

            //Get the Connectors MP and CSV Connector Class
            ManagementPack      mpConnectors      = emg.GetManagementPack("Microsoft.Demo.Connectors", null, new Version("1.0.0.0"));
            ManagementPackClass classCSVConnector = mpConnectors.GetClass("Microsoft.Demo.Connectors.CSVConnector");

            //Get the Connector object using the object ID
            EnterpriseManagementObject emoCSVConnector = emg.EntityObjects.GetObject <EnterpriseManagementObject>(this.EnterpriseManagementObjectID, ObjectQueryOptions.Default);

            //Set the property values to the new values
            emoCSVConnector[classCSVConnector, "DisplayName"].Value     = this.DisplayName;
            emoCSVConnector[classCSVConnector, "DataFilePath"].Value    = this.DataFilePath;
            emoCSVConnector[classCSVConnector, "DataFilePath"].Value    = this.DataFilePath;
            emoCSVConnector[classCSVConnector, "MappingFilePath"].Value = this.MappingFilePath;
            emoCSVConnector[classCSVConnector, "NumberMinutes"].Value   = this.NumberMinutes;

            //Update Connector instance
            emoCSVConnector.Commit();

            //Get the rule using the Connector ID and then update the data source and write action module configuration
            ManagementPackRule ruleConnector = mpConnectors.GetRule(this.ConnectorID);

            ruleConnector.DataSourceCollection[0].Configuration =
                "<Scheduler>" +
                "<SimpleReccuringSchedule>" +
                "<Interval Unit=\"Minutes\">" + this.NumberMinutes + "</Interval>" +
                "</SimpleReccuringSchedule>" +
                "<ExcludeDates />" +
                "</Scheduler>";

            ruleConnector.WriteActionCollection[0].Configuration =
                "<Subscription>" +
                "<WindowsWorkflowConfiguration>" +
                "<AssemblyName>CSVConnectorWorkflow</AssemblyName>" +
                "<WorkflowTypeName>WorkflowAuthoring.CSVConnectorWorkflow</WorkflowTypeName>" +
                "<WorkflowParameters>" +
                "<WorkflowParameter Name=\"DataFilePath\" Type=\"string\">" + this.DataFilePath + "</WorkflowParameter>" +
                "<WorkflowParameter Name=\"FormatFilePath\" Type=\"string\">" + this.MappingFilePath + "</WorkflowParameter>" +
                "</WorkflowParameters>" +
                "<RetryExceptions />" +
                "<RetryDelaySeconds>60</RetryDelaySeconds>" +
                "<MaximumRunningTimeSeconds>300</MaximumRunningTimeSeconds>" +
                "</WindowsWorkflowConfiguration>" +
                "</Subscription>";

            ruleConnector.Status = ManagementPackElementStatus.PendingUpdate;
            mpConnectors.AcceptChanges();
        }
Esempio n. 3
0
 //---------------------------------------------------------------------
 private void PopulateObjectReference(
     ListViewItem item,
     string objectName,
     string objectType
     )
 {
     if (objectType == "Monitors - Aggregate" || objectType == "Monitors - Unit" || objectType == "Monitors - Dependency")
     {
         item.Tag = m_managementPack.GetMonitor(objectName);
     }
     else if (objectType == "Rules")
     {
         item.Tag = m_managementPack.GetRule(objectName);
     }
     else if (objectType == "Views")
     {
         item.Tag = m_managementPack.GetView(objectName);
     }
     else if (objectType == "Discoveries")
     {
         item.Tag = m_managementPack.GetDiscovery(objectName);
     }
     else if (objectType == "Reports")
     {
         item.Tag = m_managementPack.GetReport(objectName);
     }
     else if (objectType == "Classes")
     {
         item.Tag = m_managementPack.GetClass(objectName);
     }
     else if (objectType == "Relationships")
     {
         item.Tag = m_managementPack.GetRelationship(objectName);
     }
     else if (objectType == "Tasks")
     {
         item.Tag = m_managementPack.GetTask(objectName);
     }
     else if (objectType == "Console Tasks")
     {
         item.Tag = m_managementPack.GetConsoleTask(objectName);
     }
     else if (objectType == "Linked Reports")
     {
         item.Tag = m_managementPack.GetLinkedReport(objectName);
     }
     else if (objectType == "Dependencies")
     {
         item.Tag = m_managementPack.References[objectName];
     }
     else if (objectType == "Recoveries")
     {
         item.Tag = m_managementPack.GetRecovery(objectName);
     }
     else if (objectType == "Diagnostics")
     {
         item.Tag = m_managementPack.GetDiagnostic(objectName);
     }
     else if (objectType == "Overrides")
     {
         item.Tag = m_managementPack.GetOverride(objectName);
     }
     else if (objectType == "Groups")
     {
         item.Tag = m_managementPack.GetClass(objectName);
     }
     else if (objectType == "Resources")
     {
         item.Tag = m_managementPack.GetResource <ManagementPackResource>(objectName);
     }
     else if (objectType == "Dashboards and Widgets")
     {
         item.Tag = m_managementPack.GetComponentType(objectName);
     }
 }
        public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
        {
            if (parameters.Contains("Create"))
            {
                WizardStory wizard = new WizardStory();

                //set the icon and title bar
                ResourceManager rm           = new ResourceManager("SCSM.AzureAutomation.WPF.Connector.Resources", typeof(Resources).Assembly);
                Bitmap          bitmap       = (Bitmap)rm.GetObject("AzureAutomation2x24");
                IntPtr          ptr          = bitmap.GetHbitmap();
                BitmapSource    bitmapsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                wizard.StoryImage        = bitmapsource;
                wizard.WizardWindowTitle = "Create Azure Automation Connector";

                WizardData data = new AzureAutomationWizardData();
                wizard.WizardData = data;

                //add th pages
                wizard.AddLast(new WizardStep("Welcome", typeof(AzureAutomationWelcomePage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Summary", typeof(AzureAutomationSummaryPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Results", typeof(AzureAutomationResultPage), wizard.WizardData));

                //Create a wizard window and show it
                WizardWindow wizardwindow = new WizardWindow(wizard);
                // this is needed so that WinForms will pass messages on to the hosted WPF control
                System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wizardwindow);
                wizardwindow.ShowDialog();

                //Update the view when done with the wizard so that the new connector shows
                if (data.WizardResult == WizardResult.Success)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Edit"))
            {
                //Get the server name to connect to and connect to the server
                String strServerName          = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
                EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

                //Get the object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
                WizardStory wizard = new WizardStory();
                wizard.WizardWindowTitle = "Edit Azure Automation Connector";
                WizardData data = new AzureAutomationWizardData(emoAAConnector);
                wizard.WizardData = data;
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));

                //Show the property page
                PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

                //Update the view when done so the new values are shown
                bool?dialogResult = wizardWindow.ShowDialog();
                if (dialogResult.HasValue && dialogResult.Value)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Delete") || parameters.Contains("Disable") || parameters.Contains("Enable"))
            {
                //Get the server name to connect to and create a connection
                String strServerName          = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
                EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

                //Get the object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                if (parameters.Contains("Delete"))
                {
                    //Remove the object from the database
                    IncrementalDiscoveryData idd = new IncrementalDiscoveryData();
                    idd.Remove(emoAAConnector);
                    idd.Commit(emg);
                }

                //Get the rule using the connector ID
                ManagementPack      mpConnectors           = emg.GetManagementPack("SCSM.AzureAutomation", "ac1fe0583b6c84af", new Version("1.0.0.0"));
                ManagementPack      mpAAConnectorWorkflows = emg.GetManagementPack("SCSM.AzureAutomation.Workflows", null, new Version("1.0.0.0"));
                ManagementPackClass classAAConnector       = mpConnectors.GetClass("SCSM.AzureAutomation.Connector");
                String             strConnectorID          = emoAAConnector[classAAConnector, "Id"].ToString();
                ManagementPackRule ruleConnector           = mpAAConnectorWorkflows.GetRule(strConnectorID);

                //Update the Enabled property or delete as appropriate
                if (parameters.Contains("Delete"))
                {
                    ruleConnector.Status = ManagementPackElementStatus.PendingDelete;
                }
                else if (parameters.Contains("Disable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = false;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@false;
                    ruleConnector.Status  = ManagementPackElementStatus.PendingUpdate;
                }
                else if (parameters.Contains("Enable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = true;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@true;
                    ruleConnector.Status  = ManagementPackElementStatus.PendingUpdate;
                }

                //Commit the changes to the connector object and rule
                emoAAConnector.Commit();
                mpAAConnectorWorkflows.AcceptChanges();

                //Update the view when done so the item is either removed or the updated Enabled value shows
                RequestViewRefresh();
            }
        }
        //This Saves the values that have been set throughout the Wizard Pages back into the management pack so the
        //Advanced Action Log Notifier can read them via ((Get-SCSMObject -Class (Get-SCSMClass -Name "AdhocAdam.Advanced.Action.Log.Notify.AdminSettings$")))
        public override void AcceptChanges(WizardMode wizardMode)
        {
            //Get the server name to connect to and then connect
            String strServerName          = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
            EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

            //Get the Advanced Action Notifier class by GUID
            ManagementPackClass adhocAdamAALNClass = emg.EntityTypes.GetClass(new Guid("49a053e7-6080-e211-fd79-ca3607eecce7"));

            //Get the SMLets Exchange Connector Settings object using the object GUID
            EnterpriseManagementObject emoAdminSetting = emg.EntityObjects.GetObject <EnterpriseManagementObject>(this.EnterpriseManagementObjectID, ObjectQueryOptions.Default);

            //Workflow Status
            //Retrieve the unsealed workflow management pack that contains the workflows, to control whether or not the workflows are enabled/disabled
            //https://marcelzehner.ch/2013/07/04/a-look-at-scsm-workflows-and-notifications-and-how-to-manage-them-by-using-scripts/
            ManagementPack     adhocAdamAALWFClass           = emg.ManagementPacks.GetManagementPack(new Guid("4db18489-38fa-895a-7149-902b675dc752"));
            ManagementPackRule assignedNotificationWF        = adhocAdamAALWFClass.GetRule("AdhocAdam.Advanced.Action.Log.Notify.TroubleTicketAnalystCommentNotification");
            ManagementPackRule affectedNotificationWF        = adhocAdamAALWFClass.GetRule("AdhocAdam.Advanced.Action.Log.Notify.TroubleTicketUserCommentNotification");
            ManagementPackRule workItemCommentNotificationWF = adhocAdamAALWFClass.GetRule("AdhocAdam.Advanced.Action.Log.Notify.WorkItemUserCommentNotification");

            assignedNotificationWF.Status        = ManagementPackElementStatus.PendingUpdate;
            affectedNotificationWF.Status        = ManagementPackElementStatus.PendingUpdate;
            workItemCommentNotificationWF.Status = ManagementPackElementStatus.PendingUpdate;

            //Notify Assigned To
            if (this.IsNotifyAssignedUserEnabled == true)
            {
                assignedNotificationWF.Enabled = ManagementPackMonitoringLevel.@true;
            }
            else
            {
                assignedNotificationWF.Enabled = ManagementPackMonitoringLevel.@false;
            }

            //Notify Affected User
            if (this.IsNotifyAffecteddUserEnabled == true)
            {
                affectedNotificationWF.Enabled = ManagementPackMonitoringLevel.@true;
            }
            else
            {
                affectedNotificationWF.Enabled = ManagementPackMonitoringLevel.@false;
            }

            //Service Request Comments
            if (this.IsNotifyWorkItemCommentsEnabled == true)
            {
                workItemCommentNotificationWF.Enabled = ManagementPackMonitoringLevel.@true;
            }
            else
            {
                workItemCommentNotificationWF.Enabled = ManagementPackMonitoringLevel.@false;
            }

            //save the changes back to the unsealed mp
            adhocAdamAALWFClass.AcceptChanges();

            //Azure Settings
            emoAdminSetting[adhocAdamAALNClass, "EnableAzureTranslate"].Value = this.IsAzureTranslateEnabled;
            emoAdminSetting[adhocAdamAALNClass, "ACSAPIKey"].Value            = this.AzureCognitiveServicesTranslateAPIKey;

            //Templates
            try { emoAdminSetting[adhocAdamAALNClass, "TroubleTicketAnalystCommentTemplate"].Value = this.TroubleTicketAnalystCommentTemplate.Id; }
            catch { }
            try { emoAdminSetting[adhocAdamAALNClass, "TroubleTicketUserCommentTemplate"].Value = this.TroubleTicketUserCommentTemplate.Id; }
            catch { }
            try { emoAdminSetting[adhocAdamAALNClass, "WorkItemCommentTemplate"].Value = this.WorkItemCommentLogTemplate.Id; }
            catch { }

            //Update the MP
            emoAdminSetting.Commit();
            this.WizardResult = WizardResult.Success;
        }
        //This Loads the settings that have been set in the management pack. In some cases for user protection, they load values from the function below
        //so on Save some kind of value is committed. This provides the means to suggest a value once, but ignore it afterwards.
        internal AdminSettingWizardData(EnterpriseManagementObject emoAdminSetting)
        {
            //Get the server name to connect to and then connect
            String strServerName          = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
            EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

            /*Get the Advanced Action Notifier class by GUID
             ##PowerShell SMlets equivalent:
             *  Get-SCSMClass -name "AdhocAdam.Advanced"
             *  Get-SCSMClass -id "49a053e7-6080-e211-fd79-ca3607eecce7"
             */
            ManagementPackClass adhocAdamAALNClass = emg.EntityTypes.GetClass(new Guid("49a053e7-6080-e211-fd79-ca3607eecce7"));

            //Azure Settings
            try { this.IsAzureTranslateEnabled = Boolean.Parse(emoAdminSetting[adhocAdamAALNClass, "EnableAzureTranslate"].ToString()); }
            catch { this.IsAzureTranslateEnabled = false; }
            this.AzureCognitiveServicesTranslateAPIKey = emoAdminSetting[adhocAdamAALNClass, "ACSAPIKey"].ToString();

            //Retrieve the unsealed workflow management pack that contains the workflows, to control whether or not the workflows are enabled/disabled
            //https://marcelzehner.ch/2013/07/04/a-look-at-scsm-workflows-and-notifications-and-how-to-manage-them-by-using-scripts/
            ManagementPack     adhocAdamAALWFClass           = emg.ManagementPacks.GetManagementPack(new Guid("4db18489-38fa-895a-7149-902b675dc752"));
            ManagementPackRule assignedNotificationWF        = adhocAdamAALWFClass.GetRule("AdhocAdam.Advanced.Action.Log.Notify.TroubleTicketAnalystCommentNotification");
            ManagementPackRule affectedNotificationWF        = adhocAdamAALWFClass.GetRule("AdhocAdam.Advanced.Action.Log.Notify.TroubleTicketUserCommentNotification");
            ManagementPackRule workItemCommentNotificationWF = adhocAdamAALWFClass.GetRule("AdhocAdam.Advanced.Action.Log.Notify.WorkItemUserCommentNotification");

            //Assigned User notification
            if (assignedNotificationWF.Enabled == ManagementPackMonitoringLevel.@false)
            {
                this.IsNotifyAssignedUserEnabled = false;
            }
            else
            {
                this.IsNotifyAssignedUserEnabled = true;
            }

            //Affected User notification
            if (affectedNotificationWF.Enabled == ManagementPackMonitoringLevel.@false)
            {
                this.IsNotifyAffecteddUserEnabled = false;
            }
            else
            {
                this.IsNotifyAffecteddUserEnabled = true;
            }

            //Work Item (Service Request) notification
            if (workItemCommentNotificationWF.Enabled == ManagementPackMonitoringLevel.@false)
            {
                this.IsNotifyWorkItemCommentsEnabled = false;
            }
            else
            {
                this.IsNotifyWorkItemCommentsEnabled = true;
            }

            //Templates
            //First, we'll pull all of the Email Templates from the Admin Settings pane
            //Get-SCSMClass -id "0814d9a7-8332-a5df-2ec8-34d07f3d40db"
            //Get-SCSMClass -name "System.Notification.Template.SMTP"
            ManagementPackObjectTemplateCriteria mpotcTTATemplates = new ManagementPackObjectTemplateCriteria("TypeID = '0814d9a7-8332-a5df-2ec8-34d07f3d40db'");

            this.TroubleTicketAnalystCommentTemplates = emg.Templates.GetObjectTemplates(mpotcTTATemplates);
            this.TroubleTicketAnalystCommentTemplates = this.TroubleTicketAnalystCommentTemplates.OrderBy(template => template.DisplayName).ToList();
            try
            {
                Guid ttacTemplate = (Guid)emoAdminSetting[null, "TroubleTicketAnalystCommentTemplate"].Value;
                this.TroubleTicketAnalystCommentTemplate = emg.Templates.GetObjectTemplate(ttacTemplate);
            }
            catch { }

            ManagementPackObjectTemplateCriteria mpotcTTUTemplates = new ManagementPackObjectTemplateCriteria("TypeID = '0814d9a7-8332-a5df-2ec8-34d07f3d40db'");

            this.TroubleTicketUserCommentTemplates = emg.Templates.GetObjectTemplates(mpotcTTUTemplates);
            this.TroubleTicketUserCommentTemplates = this.TroubleTicketUserCommentTemplates.OrderBy(template => template.DisplayName).ToList();
            try
            {
                Guid ttucTemplate = (Guid)emoAdminSetting[null, "TroubleTicketUserCommentTemplate"].Value;
                this.TroubleTicketUserCommentTemplate = emg.Templates.GetObjectTemplate(ttucTemplate);
            }
            catch { }

            ManagementPackObjectTemplateCriteria mpotcWICLTemplates = new ManagementPackObjectTemplateCriteria("TypeID = '0814d9a7-8332-a5df-2ec8-34d07f3d40db'");

            this.WorkItemCommentLogTemplates = emg.Templates.GetObjectTemplates(mpotcWICLTemplates);
            this.WorkItemCommentLogTemplates = this.WorkItemCommentLogTemplates.OrderBy(template => template.DisplayName).ToList();
            try
            {
                Guid wiclTemplate = (Guid)emoAdminSetting[null, "WorkItemCommentTemplate"].Value;
                this.WorkItemCommentLogTemplate = emg.Templates.GetObjectTemplate(wiclTemplate);
            }
            catch { }

            //load the MP
            this.EnterpriseManagementObjectID = emoAdminSetting.Id;
        }