Example #1
0
    private bool CreateJob(SPWebApplication site)
    {
        bool jobCreated = false;

        try
        {
            // schedule job for once a day
            CustomJob       job      = new CustomJob(JobName, site);
            SPDailySchedule schedule = new SPDailySchedule();
            schedule.BeginHour = 0;
            schedule.EndHour   = 1;
            job.Schedule       = schedule;
            job.Update();
        }
        catch (Exception)
        {
            return(jobCreated);
        }
        return(jobCreated);
    }