共用方式為


SPHealthAnalysisRule.Check Method

When overridden in a derived class, searches for a single problem.

Namespace:  Microsoft.SharePoint.Administration.Health
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public MustOverride Function Check As SPHealthCheckStatus
'Usage
Dim instance As SPHealthAnalysisRule
Dim returnValue As SPHealthCheckStatus

returnValue = instance.Check()
public abstract SPHealthCheckStatus Check()

Return Value

Type: Microsoft.SharePoint.Administration.Health.SPHealthCheckStatus
An enumeration value that describes the outcome of the check.

Remarks

Override this method in your derived class; then write code that identifies a single potential problem in the SharePoint environment so that it can be brought to the attention of farm administrators. Keep in mind that the code in the Check method will run on a regular schedule, and it will consume system resources every time it runs. Avoid resource-intensive queries. The code for a good implementation of the Check method executes quickly without placing significant demands on the system that it is meant to protect.

While you are developing a rule, it can be helpful to create a simple console application that invokes the rule’s Check method. This will make it easier to step through your code. After you deploy the rule, it will run in the context of the timer service. At that point you will need to attach to owstimer.exe in order to step through the code for your rule.

See Also

Reference

SPHealthAnalysisRule Class

SPHealthAnalysisRule Members

Microsoft.SharePoint.Administration.Health Namespace