我正在嘗試關注http://msdn.microsoft.com/en-us/library/cc406686.aspx以及類似的教程。我有一個自定義SPJobDefinition派生和一個功能。該定義還沒有做任何事情,因爲我只是試圖讓它安裝。該功能在FeatureActivated中具有以下代碼:試圖安裝SPJobDefinition;沒有顯示在列表中
// Get the Site Collection in which this is being activated
SPSite siteCollection = (SPSite)properties.Feature.Parent;
// Make sure the job isn't already registered
foreach (SPJobDefinition jobDefinition in siteCollection.WebApplication.JobDefinitions)
if (jobDefinition.Name.Equals(TIMER_JOB_NAME))
jobDefinition.Delete();
// Create the job
Form40EscalationTimer timerJob = new Form40EscalationTimer(
TIMER_JOB_NAME,
siteCollection.WebApplication,
null,
SPJobLockType.Job
);
SPMinuteSchedule schedule = new SPMinuteSchedule();
schedule.BeginSecond = 0;
schedule.EndSecond = 59;
schedule.Interval = int.Parse(ConfigurationManager.AppSettings["Form40EscalationJobIntervalMinutes"]);
timerJob.Schedule = schedule;
timerJob.Update();
// Install the job - not here originally, tried from http://www.codeguru.com/cpp/misc/misc/microsoftofficeoutlook/print.php/c14133__1/
siteCollection.WebApplication.JobDefinitions.Add(timerJob);
siteCollection.WebApplication.Update();
我錯過了什麼?它全部部署良好,並且該功能可以正常激活,但它不會顯示在作業定義列表中!