SPHealthReportsList.Local property

Gets an SPHealthReportsList object that represents the SharePoint Health Analyzer Reports list for the farm.

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

public static SPHealthReportsList Local { get; }

Property value

Type: Microsoft.SharePoint.Administration.Health.SPHealthReportsList
An SPHealthReportsList object that represents the SharePoint Health Analyzer Reports list for the farm.


The local server is not joined to the farm.

The SPHealthReportsList object returned by the Local property uses unmanaged resources. You are responsible for releasing those resources. One way to do that is to call the Dispose() method when you no longer need the SPHealthReportsList object.

The following example is a console application that queries the health reports list for information about health checks that have failed.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration.Health;

namespace Test
    class Program
        static void Main(string[] args)
            using (SPHealthReportsList reportsList = SPHealthReportsList.Local)
                if (reportsList != null)
                    // Write a query against the list.
                    SPQuery query = new SPQuery();
                    query.Query = string.Concat(
                                        "<FieldRef Name=\"HealthReportCategory\" Ascending=\"FALSE\"/>",
                                        "<FieldRef Name=\"HealthReportSeverity\" />",
                                            "<FieldRef Name=\"HealthReportSeverity\" />",
                                            "<Value Type=\"Text\">4 - Success</Value>",
                    // Retrieve list items that satisfy the query.
                    SPListItemCollection reports = reportsList.GetItems(query);

                    // Print information from each item.
                    string category = string.Empty;
                    foreach (SPListItem report in reports)
                        string thisCategory = report[SPBuiltInFieldId.HealthReportCategory].ToString();
                        if (thisCategory != category)
                            category = thisCategory;
                            Console.WriteLine("\nCategory: {0}", category);
                        string title = report[SPBuiltInFieldId.LinkTitleNoMenu].ToString();
                        string errorLevel = report[SPBuiltInFieldId.HealthReportSeverity].ToString();
                        Console.WriteLine("\n- {0}", title);
                        Console.WriteLine("  Severity: {0}", errorLevel);

                        object failingServers = report[SPBuiltInFieldId.HealthReportServers];
                        object failingServices = report[SPBuiltInFieldId.HealthReportServices];

                        if (failingServers != null)
                            Console.WriteLine("  Failing servers: {0}", failingServers.ToString());
                        if (failingServices != null)
                            Console.WriteLine("  Failing services: {0}", failingServices.ToString());
            Console.Write("\nPress ENTER to continue...");