Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)
Usage
| Visual Basic |
|---|
Dim instance As ManagementPackKnowledgeArticle |
Syntax
| Visual Basic |
|---|
<SerializableAttribute> _ Public Class ManagementPackKnowledgeArticle Inherits ManagementPackElementInfo |
| C# |
|---|
[SerializableAttribute] public class ManagementPackKnowledgeArticle : ManagementPackElementInfo |
| C++ |
|---|
[SerializableAttribute] public ref class ManagementPackKnowledgeArticle : public ManagementPackElementInfo |
| J# |
|---|
/** @attribute SerializableAttribute() */ public class ManagementPackKnowledgeArticle extends ManagementPackElementInfo |
| JScript |
|---|
SerializableAttribute public class ManagementPackKnowledgeArticle extends ManagementPackElementInfo |
Example
The following example demonstrates retrieval of knowledge articles and their contents.
| C# | Copy Code |
|---|---|
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Common;
using Microsoft.EnterpriseManagement.Administration;
using Microsoft.EnterpriseManagement.Configuration;
namespace SDKSamples
{
class Program
{
static void Main(string[] args)
{
ManagementGroup mg = new ManagementGroup("localhost");
ReadOnlyCollection<ManagementPackMonitor> monitors;
ReadOnlyCollection<MonitoringRule> rules;
rules = mg.GetMonitoringRules();
monitors = mg.GetMonitors();
foreach (MonitoringRule rule in rules)
{
ManagementPackKnowledgeArticle article;
try
{
article = rule.GetKnowledgeArticle(System.Globalization.CultureInfo.CurrentCulture);
}
catch (Microsoft.EnterpriseManagement.Common.ObjectNotFoundException error)
{
//There is no knowledge article for this rule.
continue;
}
if (article.HtmlContent != null)
{
//Get the HTML content.
}
else if (article.MamlContent != null)
{
//Get the MAML content. You must write an XSLT to
//transform the MAML to HTML.
}
}
foreach (ManagementPackMonitor monitor in monitors)
{
ManagementPackKnowledgeArticle article;
try
{
article = monitor.GetKnowledgeArticle(System.Globalization.CultureInfo.CurrentCulture);
}
catch (Microsoft.EnterpriseManagement.Common.ObjectNotFoundException error)
{
//There is no knowledge article for this monitor.
continue;
}
if (article.HtmlContent != null)
{
//Get the HTML content.
}
else if (article.MamlContent != null)
{
//Get the MAML content. You must write an XSLT to
//transform the MAML to HTML.
}
}
}
}
}
|
|
Inheritance
Hierarchy
System.Object
Microsoft.EnterpriseManagement.Configuration.ManagementPackItem
Microsoft.EnterpriseManagement.Configuration.ManagementPackElementInfo
Microsoft.EnterpriseManagement.Configuration.ManagementPackKnowledgeArticle
Microsoft.EnterpriseManagement.Configuration.MonitoringKnowledgeArticle
Microsoft.EnterpriseManagement.Configuration.ManagementPackItem
Microsoft.EnterpriseManagement.Configuration.ManagementPackElementInfo
Microsoft.EnterpriseManagement.Configuration.ManagementPackKnowledgeArticle
Microsoft.EnterpriseManagement.Configuration.MonitoringKnowledgeArticle
Thread Safety
Any public static (Shared in Visual
Basic) members of this type are thread safe. Any instance members
are not guaranteed to be thread safe.


