Saturday, March 12, 2011

How to enable Developer Dashboard in SharePoint 2010 programmatically using SharePoint object model?

The Developer Dashboard is a user interface component built into SharePoint 2010 Foundation that displays diagnostic information that can be useful to developers and to farm administrators in diagnosing problems with the farm.

By default, the Developer Dashboard is disabled.

You can enable developer dashboard programmatically using SharePoint 2010 object model as follows:
To enable the dashboard:
SPDeveloperDashboardSettings settings = SPWebService.ContentService.DeveloperDashboardSettings;
settings.DisplayLevel = SPDeveloperDashboardLevel.On;
settings.TraceEnabled = true;
settings.Update();

To disable the dashboard:
SPDeveloperDashboardSettings settings = SPWebService.ContentService.DeveloperDashboardSettings;
settings.DisplayLevel = SPDeveloperDashboardLevel.Off;
settings.TraceEnabled = true;
settings.Update();

No comments:

Post a Comment