SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)
share|improve this question
What scope of feature do you use? – Alexander Mar 30 '12 at 14:26
farm scope!!!!! – Esteban V Apr 2 '12 at 6:18
up vote 0 down vote accepted

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.

share|improve this answer
its farm scoped. – Esteban V Mar 30 '12 at 20:33
but then, whats the problem with my code? I wonder if the problem is with the object SPService. – Esteban V Mar 30 '12 at 20:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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