This is really weird.

The exception is thrown in the FeatureActivated event exactly in the line job.Update(). There is no way to debug any further because that method is from the framework. Maybe I am missing to set more properties in the instantiation of the object??

 public override void FeatureActivated(SPFeatureReceiverProperties properties)

                // Get an instance of the SharePoint farm.
                SPFarm farm = SPFarm.Local;

                // Get an instance of the service.
                var results = from s in farm.Services
                              where s.Name == "SynchronizationUserAccessListJob"
                              select s;

                SPService service = results.FirstOrDefault();

                // Remove job if it exists.
                if (service != null)

                // Create the job.
                SynchronizationUserAccessListJob job = new SynchronizationUserAccessListJob();

                // Create the schedule so that the job runs hourly, sometime 
                // during the first quarter of the hour.
                SPHourlySchedule schedule = new SPHourlySchedule();
                schedule.BeginMinute = 0;
                schedule.EndMinute = 5;
                job.Schedule = schedule;

 public SynchronizationUserAccessListJob() : base() 
            this.Title = "SynchronizationUserAccessListJob";

        public SynchronizationUserAccessListJob(string jobname, SPService service)
            : base(jobname, service, null, SPJobLockType.Job)
            this.Title = jobname;

        /// <summary>
        /// The timer job actually executes this method depending on its configuration, It will be done, every day.
        /// </summary>
        /// <param name="targetInstanceId"></param>
        public override void Execute(Guid targetInstanceId)
  • What scope of feature do you use?
    – Alexander
    Mar 30, 2012 at 14:26
  • farm scope!!!!! Apr 2, 2012 at 6:18

1 Answer 1


If you use SPWeb or SPSite feature scope you can have a problem with security. Read this post or this post for more details.

I suggest you to use the SPFarm or SPWebApplication scoped feature. There is no problem with security.

  • its farm scoped. Mar 30, 2012 at 20:33
  • but then, whats the problem with my code? I wonder if the problem is with the object SPService. Mar 30, 2012 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.