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)

public IDictionary<Type, Exception> AddItems(
	Assembly ruleAssembly


Type: System.Reflection.Assembly

The assembly to search for rules to be added.

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.

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 noteImportant

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