예제 #1
0
        private static void SetDeveloperDashBoardDisplayLevelSetting(ISharePointCommandContext context, string newLevel)
        {
            try
            {
                SPDeveloperDashboardLevel level = ((SPDeveloperDashboardLevel)Enum.Parse(typeof(SPDeveloperDashboardLevel), newLevel));

                SPDeveloperDashboardSettings settings = context.Site.WebApplication.WebService.DeveloperDashboardSettings;

                settings.DisplayLevel = level;

                settings.Update(true);
            }
            catch (ArgumentNullException ex)
            {
                context.Logger.WriteLine(String.Format(Resources.DeveloperDashboardCommands_SetException,
                                                       ex.Message,
                                                       Environment.NewLine,
                                                       ex.StackTrace), LogCategory.Error);
            }
            catch (ArgumentException ex)
            {
                context.Logger.WriteLine(String.Format(Resources.DeveloperDashboardCommands_SetException,
                                                       ex.Message,
                                                       Environment.NewLine,
                                                       ex.StackTrace), LogCategory.Error);
            }
            catch (OverflowException ex)
            {
                context.Logger.WriteLine(String.Format(Resources.DeveloperDashboardCommands_SetException,
                                                       ex.Message,
                                                       Environment.NewLine,
                                                       ex.StackTrace), LogCategory.Error);
            }
        }
예제 #2
0
        static void Main()
        {
            SPDeveloperDashboardSettings settings =
                SPWebService.ContentService.DeveloperDashboardSettings;

            settings.DisplayLevel = SPDeveloperDashboardLevel.On;
            settings.TraceEnabled = true;
            settings.Update();
        }