Beispiel #1
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPSite site = properties.Feature.Parent as SPSite;

                // make sure the job isn't already registered
                site.WebApplication.JobDefinitions.Where(t => t.Name.Equals(List_JOB_NAME)).ToList().ForEach(j => j.Delete());

                //job por minuto

                /*
                 * MonitoraJob listLoggerJob = new MonitoraJob(List_JOB_NAME, site.WebApplication);
                 * SPMinuteSchedule schedule = new SPMinuteSchedule();
                 * //schedule.BeginSecond = 0;
                 * //schedule.EndSecond = 59;
                 * schedule.Interval = 1;
                 */

                //job por dia
                MonitoraJob listLoggerJob = new MonitoraJob(List_JOB_NAME, site.WebApplication);
                SPDailySchedule schedule  = new SPDailySchedule();
                //schedule.BeginSecond = 0;
                //schedule.EndSecond = 59;
                schedule.BeginHour = 5;
                schedule.EndHour   = 6;

                listLoggerJob.Schedule = schedule;
                listLoggerJob.Update();
            });
        }
Beispiel #2
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPSite site = properties.Feature.Parent as SPSite;

                // make sure the job isn't already registered
                site.WebApplication.JobDefinitions.Where(t => t.Name.Equals(List_JOB_NAME)).ToList().ForEach(j => j.Delete());

                //job a cada 30min
                MonitoraJob listLoggerJob = new MonitoraJob(List_JOB_NAME, site.WebApplication);
                SPMinuteSchedule schedule = new SPMinuteSchedule();
                schedule.Interval         = 30;

                listLoggerJob.Schedule = schedule;
                listLoggerJob.Update();
            });
        }