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)
{
DeleteJob(service);
}
// 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;
job.Update();
}
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)
{