2010-11-19 3 views
1

는이 같은 클래스가 :SharePoint 타이머 작업에 내 Feature.xml을 설치하는 방법은 무엇입니까?

namespace SharePointSocialNetworking 
{ 
    public class FeatureToEnableJob : SPFeatureReceiver 
    { 
     public override void FeatureActivated(SPFeatureReceiverProperties properties) 
     { 

     SPSite site = properties.Feature.Parent as SPSite; 

     // Make sure the job isn't already registered. 
     foreach (SPJobDefinition job in site.WebApplication.JobDefinitions) 
     { 
      if (job.Name == "SPFacebookJob") 
       job.Delete(); 
     } 

     // Install the job. 
     Facebook fbJob = new Facebook(); 

     SPMinuteSchedule schedule = new SPMinuteSchedule(); 
     schedule.BeginSecond = 0; 
     schedule.EndSecond = 59; 
     schedule.Interval = 2; 
     fbJob.Schedule = schedule; 

     fbJob.Update(); 
     } 
     ... 
    } 

} 

을 그리고이 제 기능 XML입니다 : SharePointSocialNetworking

<?xml version="1.0" encoding="utf-8"?> 
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" 
Id="b9e40341-32ab-410a-a20f-282cf13fb54b" 
ReceiverAssembly="SharePointSocialNetworking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6264b0911592ad29" 
ReceiverClass="SharePointSocialNetworking.FeatureToEnableJob" 
Scope="Farm" 
Title="SharePoint Social Networking Job"> 
</Feature> 

내 어셈블리를 호출된다. 내가 여기서 뭐 잘못하고 있니?

나는 모든 적절한 설정을 한 적이하지만이 명령을 실행하면

stsadm -o installfeature -name SharePointSocialNetworking 

을 다음과 같은 에러가 발생합니다

Object reference not set to an instance of an object. 

답변

0

당신의 기능 부모 사이트하지만 농장, 당신은하지 않습니다 SPSite로 캐스팅하지 않아야합니다.

관련 문제