I hate SharePoint.
I am trying to install a SharePoint timer via a feature. My feature is scoped as Web (scoping to WebApplication gives me an Access Denied error when I try and deploy).
My 2 constructors in timer class:
public CheckListForOldItems() : base()
{
}
public CheckListForOldItems(SPWebApplication webApp) :
base(JOB_NAME, webApp, null, SPJobLockType.Job)
{
Title = "Check list for items which have not been modified recently.";
}
In the event receiver for FeatureActivated event I have
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
CheckListForOldItems simpleJob = new CheckListForOldItems(webApp);
SPMinuteSchedule schedule = new SPMinuteSchedule();
schedule.BeginSecond = 0;
schedule.EndSecond = 59;
schedule.Interval = 1;
simpleJob.Schedule = schedule;
simpleJob.Update();
}
The project is set to no active deployment.
In SP when I activate the feature I get an error saying "An unexpected error has occurred. Correlation ID: bd1d16f6-e7c9-46c6-9a06-9103bd37858f
If I uncomment all lines of code in FeatureActivated except for the first one it activates without error, so it dies at the class declaration line.
What am I doing wrong?