Retrieves the specified knowledge article from the management pack. Namespace: Microsoft.EnterpriseManagement.Configuration
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)

Usage

Visual Basic
Dim instance As ManagementPack
Dim culture As CultureInfo
Dim returnValue As ManagementPackKnowledgeArticle

returnValue = instance.GetKnowledgeArticle(culture)

Syntax

Visual Basic
Public Function GetKnowledgeArticle ( _
		culture As CultureInfo _
) As ManagementPackKnowledgeArticle
C#
public ManagementPackKnowledgeArticle GetKnowledgeArticle (
		CultureInfo culture
)
C++
public:
ManagementPackKnowledgeArticle^ GetKnowledgeArticle (
		CultureInfo^ culture
)
J#
public ManagementPackKnowledgeArticle GetKnowledgeArticle (
		CultureInfo culture
)
JScript
public function GetKnowledgeArticle (
		culture : CultureInfo
) : ManagementPackKnowledgeArticle

Parameters

culture

Specifies the locale for the article. A management pack can contain multiple localized versions of an article.

Return Value

The article for the specified locale.

Example

The following example demonstrates a use of the GetKnowledgeArticle method.

Visual Basic  Copy Code
Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports Microsoft.EnterpriseManagement
Imports Microsoft.EnterpriseManagement.Administration
Imports Microsoft.EnterpriseManagement.Common
Imports Microsoft.EnterpriseManagement.Configuration
Imports Microsoft.EnterpriseManagement.Monitoring
Imports System.Text

Namespace SDKSamples
	Class Program
		Public Overloads Shared Function Main(ByVal args() As String) As Integer

			Dim mg As ManagementGroup = New ManagementGroup("localhost")
			Dim monitors As ReadOnlyCollection(Of ManagementPackMonitor)
			Dim rules As ReadOnlyCollection(Of MonitoringRule)
			rules = mg.GetMonitoringRules()
			monitors = mg.GetMonitors()
			For Each rule As MonitoringRule In rules

				Dim article As ManagementPackKnowledgeArticle
				Try

					article = rule.GetKnowledgeArticle(System.Globalization.CultureInfo.CurrentCulture)

				Catch e As Microsoft.EnterpriseManagement.Common.ObjectNotFoundException

					' There is no knowledge article for this rule.
					Continue For
				End Try

				If Not article.HtmlContent Is Nothing Then

					' Get the HTML content.

				ElseIf Not article.MamlContent Is Nothing Then

					' Get the MAML content. You must write an XSLT to 
					' transform the MAML to HTML.
				End If
			Next

			For Each monitor As ManagementPackMonitor In monitors

				Dim article As ManagementPackKnowledgeArticle
				Try

					article = monitor.GetKnowledgeArticle(System.Globalization.CultureInfo.CurrentCulture)

				Catch e As Microsoft.EnterpriseManagement.Common.ObjectNotFoundException

					' There is no knowledge article for this monitor.
					Continue For
				End Try

				If Not article.HtmlContent Is Nothing Then

					' Get the HTML content.

				ElseIf Not article.MamlContent Is Nothing Then

					' Get the MAML content. You must write an XSLT to 
					' transform the MAML to HTML.
				End If
			Next
		End Function
	End Class
End Namespace
C#  Copy Code
using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Common;
using Microsoft.EnterpriseManagement.Administration;
using Microsoft.EnterpriseManagement.Configuration;
using System.Collections.ObjectModel;

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.
			}
		}
	}
}
}

Remarks

A knowledge article is a collection of rule comments regarding the meaning and importance of events.


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.

Platforms

Development Platforms

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

Target Platforms

Windows Server 2008,Windows Server 2003,Windows Vista,Windows XP

See Also