共用方式為


SPHealthRulesList.AddItems Method

Creates list items and timer jobs for all rules in an assembly.

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

Syntax

'Declaration
Public Function AddItems ( _
    ruleAssembly As Assembly _
) As IDictionary(Of Type, Exception)
'Usage
Dim instance As SPHealthRulesList
Dim ruleAssembly As [Assembly]
Dim returnValue As IDictionary(Of Type, Exception)

returnValue = instance.AddItems(ruleAssembly)
public IDictionary<Type, Exception> AddItems(
    Assembly ruleAssembly
)

Parameters

Return Value

Type: System.Collections.Generic.IDictionary<Type, Exception>
A list of types that could not be added and the exceptions that were thrown when the method tried to add them.

Remarks

The AddItems method examines the specified assembly and finds all public classes that are derived from the SPHealthAnalysisRule class (including classes derived from the SPRepairableHealthAnalysisRule class). For each class that it finds, the method creates a list item in the SharePoint Health Analyzer Rules list and a timer job to execute the rule defined by the class.

Important

Before calling this method, get the value of the ParentWeb property of the list and then set that object’s AllowUnsafeUpdates property to true.

See Also

Reference

SPHealthRulesList Class

SPHealthRulesList Members

Microsoft.SharePoint.Administration.Health Namespace