Enable Developer Dashboard in SharePoint 2010


Introduction:

In this article we will be seeing how to enable developer dashboard in SharePoint 2010. Developer Dashboard is a new feature in SharePoint 2010 which is used to provide additional performance and tracing information. By default, developer dashboard is disabled. We can enable using powershell or using SharePoint object model.

Enable Developer Dashboard:

  1. Using SharePoint object model

  2. Using powershell

Using SharePoint object model:

  • Open Visual Studio 2010.

  • Go to File => New => Project.

  • Select Console Application template from the installed templates.

  • Enter the Name and click Ok.

  • Add the following assembly.

  1. Microsoft.SharePoint.dll

  • Add the following namespaces.

  1. Using Microsoft.SharePoint;

  2. Using Microsoft.Sharepoint.Administration;

  • Replace Program.cs with the following code.

  1. using System;

  2. using System.Collections.Generic;

  3. using System.Linq;

  4. using System.Text;

  5. using Microsoft.SharePoint;

  6. using Microsoft.SharePoint.Administration;

  7. namespace EnableDeveloperDashboard

  8. {

  9. class Program

  10. {

  11. static void Main(string[] args)

  12. {

  13. SPWebService contentService =SPWebService.ContentService;

  14. contentService.DeveloperDashboardSettings.DisplayLevel =SPDeveloperDashboardLevel.OnDemand;

  15. contentService.DeveloperDashboardSettings.RequiredPermissions =SPBasePermissions.EmptyMask;

  16. contentService.DeveloperDashboardSettings.Update();

  17. }   

  18. }

  19. }

  • Build the solution.

  • Hit F5.

  • Because the mode is "OnDemand", you could see small icon next to the login credentials.





  • On clicking the icon you could see the developer dashboard in the bottom of the page.

  • If the mode is "On" the developer dashboard will be available in the bottom of the page and icon won't be available.


SPDeveloperDashboardLevel Enumerator:

It is used to specify behavior aspects of the developer dashboard. Behavior is either off, on, or On Demand.


Off Dashboard feature is disabled.

OnDemand Dashboard feature is available on request.

On Dashboard feature is enabled.

Using powershell:

"On" Mode:

  1. $contentService=[Microsoft.SharePoint.Administration.SPWebService]::ContentService

  2. $contentService.DeveloperDashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On

  3. $contentService.DeveloperDashboardSettings.RequiredPermissions = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

  4. $contentService.DeveloperDashboardSettings.Update()

"Off" Mode:

  1. $contentService=[Microsoft.SharePoint.Administration.SPWebService]::ContentService

  2. $contentService.DeveloperDashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::Off

  3. $contentService.DeveloperDashboardSettings.RequiredPermissions = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

  4. $contentService.DeveloperDashboardSettings.Update()

"OnDemand" Mode:

  1. $contentService=[Microsoft.SharePoint.Administration.SPWebService]::ContentService

  2. $contentService.DeveloperDashboardSettings.DisplayLevel =[Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::OnDemand

  3. $contentService.DeveloperDashboardSettings.RequiredPermissions = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

  4. $contentService.DeveloperDashboardSettings.Update()