SPDiagnosticsService.ResetItem 方法 (IDiagnosticsLevel)

请注意:此 API 现在已过时。

重置默认值报告为所指定的IDiagnosticsLevel对象类别的阈值。

命名空间:  Microsoft.SharePoint.Administration
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
<ObsoleteAttribute("directly modify severities on SPDiagnosticsCategory")> _
Public Sub ResetItem ( _
    item As IDiagnosticsLevel _
)
用法
Dim instance As SPDiagnosticsService
Dim item As IDiagnosticsLevel

instance.ResetItem(item)
[ObsoleteAttribute("directly modify severities on SPDiagnosticsCategory")]
public void ResetItem(
    IDiagnosticsLevel item
)

参数

实现

IDiagnosticsManager.ResetItem(IDiagnosticsLevel)

示例

下面的示例演示一个控制台应用程序,重置默认报表的统一记录服务类别的阈值。

Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Administration

Module ConsoleApp

   Sub Main()

      Dim diagnostics As SPDiagnosticsService = SPDiagnosticsService.Local
      If Not diagnostics Is Nothing Then
         Dim category As IDiagnosticsLevel = diagnostics.GetItem("Unified Logging Service")
         If Not category Is Nothing Then
            diagnostics.ResetItem(category)
            diagnostics.Update()
         End If
      End If

      Console.Write(vbCrLf + "Press ENTER to continue...")
      Console.ReadLine()
   End Sub

End Module
using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         SPDiagnosticsService diagnostics = SPDiagnosticsService.Local;
         if (diagnostics != null)
         {
            IDiagnosticsLevel category = diagnostics.GetItem("Unified Logging Service");
            if (category != null)
            {
               diagnostics.ResetItem(category);
               diagnostics.Update();
            }
         }
         Console.Write("\nPress ENTER to continue...");
         Console.ReadLine();
      }
   }
}

另请参阅

引用

SPDiagnosticsService 类

SPDiagnosticsService 成员

ResetItem 重载

Microsoft.SharePoint.Administration 命名空间

SetItem(IDiagnosticsLevel, TraceSeverity, EventSeverity)