Tip #1: Enable SharePoint 2010 Developer Dashboard
I know when working with SharePoint 2010 I need the ability to enable the developer dashboard and sometimes I don't have the code around so I just need a quick snippet to enable the dashboard. Make sure you add a reference to 'Microsoft.SharePoint.dll'. This enables the dashboard for all pages:
SPWebService contentService = SPWebService.ContentService;
SPDeveloperDashboardSettings developerDashBoard = contentService.DeveloperDashboardSettings;
developerDashBoard.DisplayLevel = SPDeveloperDashboardLevel.On;
developerDashBoard.Update();
Console.WriteLine("Developer dashboard has been enabled.");
If you need the developer dashboard enabled on a per-page basis just change the display level property of the SPDeveloperDashboardSettings object to :
developerDashBoard.DisplayLevel = SPDeveloperDashboardLevel.OnDemand;
I hope this helps!
Remember, if you need any custom sharepoint development or consulting please see Vorality Consulting for more information.
No comments:
Post a Comment