{"id":476,"date":"2010-06-20T18:22:21","date_gmt":"2010-06-20T16:22:21","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=476"},"modified":"2015-09-08T20:31:51","modified_gmt":"2015-09-08T18:31:51","slug":"set-developer-dashboard-level-by-visual-studio","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/set-developer-dashboard-level-by-visual-studio\/","title":{"rendered":"Set Developer Dashboard level by Visual Studio"},"content":{"rendered":"<p>In my <a href=\"https:\/\/www.itidea.nl\/index.php\/developer-dashboard\/\">previous <\/a>post about the Developer Dashboard I showed you how to switch it on\/off\/on demand by PowerShell.<br \/>\nOfcourse this can be done in Visual Studio as well:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nSPWebService cs = SPWebService.ContentService;\r\ncs.DeveloperDashboardSettings.DisplayLevel = (SPDeveloperDashboardLevel)selectedValue;\r\ncs.DeveloperDashboardSettings.Update();\r\n<\/pre>\n<p>Make sure, if you make a webpart to set the developer dashboard level, you deploy this as a Farm Solution and deploy it to the Central Administration (Project Properties, set Site URL to your CA location).<br \/>\nThe code will not work on another site, only at the CA, because the developer dashboard is a farm wide setting. If you do try to use the webpart in another site than CA, a security exception will be thrown:<br \/>\nSystem.Security.SecurityException: Access denied.<\/p>\n<p>When you deploy the solution to the CA and try to use it on another site (or visa versa) you get the message:<br \/>\nA Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe.<\/p>\n<p>After deploying\u00a0a webpart to set the level of the Developer Dashboard, just go to the\u00a0Central Administration e.g. to the Application Management page and edit the page. Two webpart zones will be visible and just add the webpart as you normally would.<br \/>\nAn example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-479\" title=\"DeveloperDashBoardVisualStudio\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/06\/DeveloperDashBoardVisualStudio.png\" alt=\"\" width=\"246\" height=\"143\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post about the Developer Dashboard I showed you how to switch it on\/off\/on demand by PowerShell. Ofcourse this can be done in Visual Studio as well: SPWebService cs = SPWebService.ContentService; cs.DeveloperDashboardSettings.DisplayLevel = (SPDeveloperDashboardLevel)selectedValue; cs.DeveloperDashboardSettings.Update(); Make sure, if &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/set-developer-dashboard-level-by-visual-studio\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[20,42,6],"class_list":["post-476","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-c","tag-sharepoint-2010","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=476"}],"version-history":[{"count":7,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/476\/revisions"}],"predecessor-version":[{"id":482,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/476\/revisions\/482"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}