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

I am trying to make a simple timer job which does some task.

However its throwing an exception object reference not set to reference of an object as the input parameter SPFeatureReceiverProperties is coming as null.

On further debugging,it throws file not found exception however ,I rechecked my Urls they are alright.

Currently I am deploying my WSP by using central Admin.

My feature.xml looks like this

<?xml version="1.0" encoding="utf-8"?>
<Feature xmlns=""
ReceiverAssembly="ExceptionalAccessSendMail, Version=, Culture=neutral,      

here is the EventReciever feature Activated Function

    [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
    public override void FeatureActivated(SPFeatureReceiverProperties properties)

        if (properties == null)
            throw new ArgumentException("properties");
            if( (properties!=null) && (properties.Feature!=null) &&    
     (properties.Feature.Parent is SPWebApplication))
                SPWebApplication spWebApplication = properties.Feature.Parent as   

                if (spWebApplication == null)
                    throw new SPException("null object SPWebApplication in class 

                foreach (SPJobDefinition jobDefinition in  
                    if (jobDefinition.Name == Globals.JOBNAME) jobDefinition.Delete();

                ExceptionalRevokeNotificationJob exceptionalRevokeNotificationJob =
                    new ExceptionalRevokeNotificationJob(spWebApplication);

                SPMinuteSchedule schedule = new SPMinuteSchedule();
                schedule.BeginSecond = 0;
                schedule.EndSecond = 59;
                schedule.Interval = 1;

                exceptionalRevokeNotificationJob.Schedule = schedule;
        catch (Exception ex)


The execute looks like below

public override void Execute(Guid targetInstanceId)

            lock (this)

                if ((this.WebApplication != null) && (this.WebApplication.Sites.Count 
    > 0) && (this.WebApplication.Sites["sites/development/ExceptionalAccess"] != null))
                    SPSite spSite = this.WebApplication.Sites["sites/development
                    string s = string.Empty;

                    using (SPWeb web = spSite.OpenWeb())
                        s = web.Url;


        catch (Exception ex)


Any Ideas and help will be greatly appreciated.

thanks in Advance

share|improve this question
please add some code to this post to let us help solve this problem – Anders Rask Jul 16 '11 at 12:23

Since you scoped the feature on webapplication level, you have to get the properties like:

SPWebApplication webApp = properties.Feature.Parent as SPWebApplication

Are you using this? Returns webApp null?

share|improve this answer
I am getting properties as null ..... – Devo Jul 18 '11 at 4:21
Could you please update your question with the code you are using? – Anita Boerboom Jul 18 '11 at 8:33
Hi I have updated my question with snippets – Devo Jul 18 '11 at 11:44
I tested your code and I can't get the SPFeatureReceiverProperties null. Is there any more info I need to know about? – Anita Boerboom Jul 19 '11 at 11:05

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.