Exemple #1
0
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite site = properties.Feature.Parent as SPSite;

            // make sure the job isn't already registered

            foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)
            {
                if (job.Name == List_JOB_NAME)
                {
                    job.Delete();
                }
            }

            // install the job

            ListTimerJob listLoggerJob = new ListTimerJob(List_JOB_NAME, site.WebApplication);

            SPMinuteSchedule schedule = new SPMinuteSchedule();

            schedule.BeginSecond = 0;

            schedule.EndSecond = 59;

            schedule.Interval = 5;

            listLoggerJob.Schedule = schedule;

            listLoggerJob.Update();
        }
Exemple #2
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            DeleteExistingJob(properties);

            // install the job
            ListTimerJob     listLoggerJob = new ListTimerJob(List_JOB_NAME, (properties.Feature.Parent as SPSite).WebApplication);
            SPMinuteSchedule schedule      = new SPMinuteSchedule {
                BeginSecond = 0, EndSecond = 59, Interval = 5
            };

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