Creating Custom Timer Job in SharePoint 2010

24 Jul

In this post I will show you how to create Custom Timer Job in SharePoint 2010 but you must know this post is based on Creating Custom SharePoint Timer Jobs ,
Update [12/11/2011]
You can download the source code of this article from the following code (Please do not forget to rate it)
You do not need any things else just open it in Visual Studio 2010 and deploy it.That’s all
So let us start
Create Custom List and name it  ListTimerJob
Open Visual Studio 2010 >File > New >Project >SharePoint 2010>Empty SharePoint Project. >Name it Custom_TimerJob>Ok

Check Deploy as farm solution>Finish

create a class that inherits from the Microsoft.SharePoint.Administration.SPJobDefinition class. To implement this class, you need to create a few constructors and override the Execute() method as following
namespace DotnetFinder
    class ListTimerJob : SPJobDefinition
         public ListTimerJob()

            : base()


        public ListTimerJob(string jobName, SPService service, SPServer server, SPJobLockType targetType)

            : base(jobName, service, server, targetType)


        public ListTimerJob(string jobName, SPWebApplication webApplication)

            : base(jobName, webApplication, null, SPJobLockType.ContentDatabase)

            this.Title = "List Timer Job";


        public override void Execute(Guid contentDbId)

            // get a reference to the current site collection's content database

            SPWebApplication webApplication = this.Parent as SPWebApplication;

            SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];

            // get a reference to the "ListTimerJob" list in the RootWeb of the first site collection in the content database

            SPList Listjob = contentDb.Sites[0].RootWeb.Lists["ListTimerJob"];

            // create a new list Item, set the Title to the current day/time, and update the item

            SPListItem newList = Listjob.Items.Add();

            newList["Title"] = DateTime.Now.ToString();



As you can see this job just add a new item to a ListTimerJob list every time it’s executed

Now that you have the job built> Right click on the Features >Add Feature

Right click on the Feature1 ” you can rename the Feature1 to any name” > Add Event Receiver

As you can see the event Receiver class inherits from the Microsoft.SharePoint.SPFeatureReceiver and This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade. But we only need FeatureActivated & FeatureDeactivated event handler to install/uninstall our custom timer job as following

namespace DotnetFinder.Features.Feature1
public class Feature1EventReceiver : SPFeatureReceiver
        const string List_JOB_NAME = "ListLogger";
        // Uncomment the method below to handle the event raised after a feature has been activated.

        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 == List_JOB_NAME)



            // install the job

            ListTimerJob listLoggerJob = new ListTimerJob(List_JOB_NAME, site.WebApplication);

            SPMinuteSchedule schedule = new SPMinuteSchedule();

            schedule.BeginSecond = 0;

            schedule.EndSecond = 59;

            schedule.Interval = 5;

            listLoggerJob.Schedule = schedule;



        // Uncomment the method below to handle the event raised before a feature is deactivated.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
            SPSite site = properties.Feature.Parent as SPSite;

            // delete the job

            foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)

                if (job.Name == List_JOB_NAME)





Before Deploying you should select the right scope of the Feature in other words in which scope you will activate the Feature(Farm,Site,Web,WebApplication) in our case we will activate Feature1 on Site which is mean Site Collection.

Note : if you trying to activate the feature in the wrong scope will get the following error

Now let us deploy our custom timer job >Right Click on Custom_TimerJob project > Click Deploy

Open now your SharePoint site and select ListTimerJob List and you should see something similar to the following image

Our custom timer job is working fine now you can go and check it and modify the schedule as following
Go to SharePoint 2010 central administration >Monitoring >in the Timer Jobs Section Select Review Job Definitions
and you should See our Custom Timer Job

Click on it and you should see Edit Timer Job Page ,Modify Timer Job schedule based on your requirement
Note : you can also modify schedule of your custom Timer Job from the code but you need to add one of the following class in FeatureActviated Event Handler as following

After Specific Minutes use SPMinuteSchedule class
Hourly use SPHourlySchedule class
Daily use SPDailySchedule class
Weekly use SPWeeklySchedule class
Monthly use SPMonthlySchedule class

Updated [ 8/10/2011]

Posted by on July 24, 2010 in SharePoint


Tags: , , , , , ,

139 responses to “Creating Custom Timer Job in SharePoint 2010

  1. TheStig

    October 5, 2010 at 10:28 am

    Works fine! …thankyou!

    • sudhir

      April 20, 2013 at 10:23 am

      Nice post. Got a lot of important stuff from this blog.
      dba kings

    • Jessie Cochran

      May 7, 2013 at 7:42 pm

      The Built in Immediate Alerts job on our Foundations server is no longer working. Would it be possible to create a custom job for this? I am in NO way a coder so any help would be very greatly appreciated.

  2. Coltrane

    October 15, 2010 at 12:11 am

    Excellent example of 2010 timer job

  3. Ahmed Naji

    October 15, 2010 at 6:08 pm

    Glad you like it , Thanks for reply

    • showkath

      September 8, 2011 at 12:34 pm

      Aslam Aleykum , wonderful example, as i am new to timer jobs, allow me to contact to you once i face any issues.

  4. Clyde

    November 23, 2010 at 12:19 pm

    Thanks for this post. One question I have searched everywhere for but found no answer: Where do you specify a value that appears in the timer job definition page to the right of the field “Job Description?”

    You cannot do this:

    listLoggerJob.Description = “My job description”;

    because the member is “read-only”

    You cannot use the Description attribute of the Feature definition in feature.xml because that does not appear in the job definition.

    Any thoughts?

    • uk jobs

      March 7, 2012 at 3:31 am

      i agree with you.
      I also had the same problems before

  5. Ahmed Naji

    November 23, 2010 at 6:28 pm

    I’m not really sure if that possible i mean setting description from code but what i know you can only type description of timer job in the feature.xml.Although it does not appear in the job definition??
    I will try to ask question in msdn forums.
    Thanks you for reply.

  6. Tim J

    November 27, 2010 at 7:50 pm

    I get this error:

    Error 1 Error occurred in deployment step ‘Add Solution’: Failed to create receiver object from assembly “DotNetFinder, Version=, Culture=neutral, PublicKeyToken=cd7250552f7daf2e”, class “$SharePoint.Type.647bd604-17ba-4e00-bc33-f6929a550fe4.FullName$” for feature “DotNetFinder_Feature1” (ID: 15564d79-a3e0-4479-9b66-aa87f36120ec).: System.ArgumentNullException: Value cannot be null.
    Parameter name: type
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
    0 0 DotNetFinder

  7. Ahmed Naji

    November 28, 2010 at 6:31 am

    Hi Tim J
    I think the error occurred because you copy and past the code and i forgot to decorate event receiver class “Feature1EventReceiver” with Guid attribute ,So to be able to deploy the package just add guid attribute like following
    public class Feature1EventReceiver : SPFeatureReceiver
    Now the solution should will be deployed without any errors
    Please feel free to tell me if the solution does not work with you
    Many thanks for your reply

  8. Sune Popp

    December 9, 2010 at 2:25 pm

    Thank you for a very good and strait forward tutorial on how to make custom timer job!

    A little tip I will share: If you make changes to your code, you need to restart the SharePoint Timer service. I didn’t know that, and had a very frustrating day at work untill I finally found out. 🙂

    // Sune

  9. Ahmed Naji

    December 9, 2010 at 8:42 pm

    Thank you very much Sune Popp for this Tip
    Best Regards.

  10. Scott

    December 16, 2010 at 3:38 pm

    Very nice…thanks!

  11. Koen Zomers

    January 7, 2011 at 4:54 pm

    Excellent article! Works superb. Thanks for sharing.

  12. vinod

    January 15, 2011 at 5:38 pm


    Nice article…I’m deleting all the items in the list and adding a new set of items through the timer job u described above but I’m getting this error ” Collection was modified; enumeration operation may not execute ” when I checked in the event viewer. Can u pls help me in this. Thank you.

  13. Ahmed Naji

    January 16, 2011 at 5:28 am

    Hi vinod
    You got this error because you are trying to delete the listitems from first item to last item. If we do like that, after deletion of single items, that will update the index value of list item collection. Because of that we are getting the error.

    Instead you have to enumerate the list collection from last item to first item and the delete them. See the following snippet,

    SPWeb mySite = SPContext.Current.Web;
    SPListItemCollection listItems = mySite.Lists[“ListName”].Items;
    int itemCount = listItems.Count;

    // start delete from the last item
    for (int k=itemCount – 1; k >= 0; k–)
    I hope that help.

  14. lhmansano

    January 19, 2011 at 12:00 pm

    Very nice post!! Thank you!

    LHM – Brazil

  15. MJ

    January 19, 2011 at 10:01 pm

    It works fine when I deploy via Visual Studio, but I had trouble activating the feature when deploying via stsadm.

    Ever see that? Do you know what I might have messsed up?


  16. Ahmed Naji

    January 19, 2011 at 11:27 pm

    Thanks for your comment

  17. Ahmed Naji

    January 19, 2011 at 11:41 pm

    Hi Mj
    The feature must be activated at site collection scope,So please check out that you activate the feature as site collection feature.See the following stsadm command
    stsadm -o activatefeature -url http://localhost -id featureGuid

    • aleem qureshi

      October 31, 2012 at 1:46 pm

      thanks for the activatefeature command. I deploy my custom timer job in production and for the life of me, was not able to figure out why it was not displaying in the Job Definations list on production box. I was missing the above command. It is working like a charm. thanks again. Good work.

  18. Hemanr Basavapattan

    January 27, 2011 at 8:42 am

    have created a custom timer job using Visual Studio 2010 ultimate and have deployed the same in Sharepoint 2010 environment.

    The timer job is deployed successfully but the problem is it not running. the The last run time it is showing is NA.

    Since its a sample timer job it logs event into event viewer..

    Even if i click on “Run Now” button then also it is not running. tried to check LOg file also on 14 hive structure but could not find anything…

    Pls assist

  19. Ahmed Naji

    January 27, 2011 at 8:20 pm

    Hi Hemanr Basavapatta
    can you show me your code.Maybe it’s lack of permission.

  20. vinod

    February 6, 2011 at 5:10 pm

    Hi Ahmed,

    Thanks a lots that worked for me. I’m facing another problem now. When I deployed the solution through visual studio in my development environment the timer job got created successfully but when i deployed the timer job as wsp file through stsadm commands in the production environment where i don have a visual studio at all the time job is not getting created. Can u tell me what cud be the reason ?? Thank you.

  21. Ahmed Naji

    February 7, 2011 at 6:42 pm

    Hi vinod
    You need to activate the feature after deploying it as following
    stsadm -o activatefeature -url http://localhost -id featureGuid
    try it and tell me if it’s work with you or not

  22. Vinod

    February 9, 2011 at 8:08 am

    Hi Ahmed,

    Thanks a lots Ahmed. Its working now! 🙂

  23. Ahmed Naji

    February 9, 2011 at 9:53 am

    Thanks a lot for your comments.

  24. mark

    February 11, 2011 at 4:41 am

    There is a very important step that needs to be completed with any Timer Project. You hav to recycle the SharPoint timer service in between deployments. Best way to do this is to add
    net stop SPTimerV4 – Pre Build
    net start SPTimerV4 – Post Build
    to your sharepoint project. If you do not do the above – you will be puzzled as to why your code seems not to be up to date. The reason is that the timer service Caches the assembly with your class. This can cost you hours of troubleshooting, in trying to identify why your code does not deploy.

    • Thiru

      August 6, 2011 at 9:52 am

      Thanks alot to Ahmed For posting such a nice one.
      Thanks To Mark for really useful tip, i really wasted couple of hours as changes in code were
      not reflected coz of timer reset issue.


  25. arun

    February 17, 2011 at 9:58 am

    Hi Is any body can tell what is the purpose of timer jobs ? how it works ?

  26. Mike

    February 20, 2011 at 10:16 pm

    Excellent timer job sample. It works great. I appreciate your work and thank you for sharing.

  27. Nicolas

    March 3, 2011 at 11:21 am


    I liked your tutorial, pretty readable compared to the one you’re referring from.
    I’m wondering, does this allow you to start a daemon on any site or only within the central admin?
    If I try to start a daemon (through this feature) in a standard site. I get an access denied. (same code though)

  28. Ahmed Naji

    March 3, 2011 at 7:13 pm

    Hi Nicolas
    Check out this post in msnd forum
    Tell me please if it help you or not
    Thanks & Regards

  29. Mahesh Patil

    March 11, 2011 at 12:20 pm

    Hi Ahmed,
    Thanks for your post. Timer job is working fine. But I am facing one issue is, while deactivating feature I am trying to delete timer job. Though I am getting job (i.e. not null); it throws NullReference Exception. also I have added this code within SPSecurity.RunWithElevatedPrivileges block. then also it throws same error.


  30. Kurt

    March 16, 2011 at 9:21 am

    Hi Ahmed,

    Your example works great. When I deploy I see the feature actived on my main site collection.
    On a second site collection in the same web application I see the feature not activated. When I click “activate” I get an access denied error.

    Any idea why I can’t activate the feature in other site collections ?

    Thanks in advance,

  31. Ahmed Naji

    March 17, 2011 at 6:21 pm

    Hi Mahesh Patil
    I have participated in one of the similar question in MSDN forums take a look to it.
    SharePoint 2010 TimerJob Not Deleting
    please inform me if that help you or not

  32. Thakhi Shaik

    March 28, 2011 at 12:00 pm

    Hi Ahmad

    Nice article.It helped me a lot


  33. Narmadha

    April 6, 2011 at 9:06 am

    Hi Ahmed Naji ,

    I m new to development .. but when i saw this post its Very nice . Really it is superb easily understandable.. I created the timer job and when i activate the feature its throwing acess denied.. In my code i have used delegates also. Kindly suggest the solution. Thanks….

  34. Ahmed Naji

    April 6, 2011 at 6:37 pm

    Hi Narmadha
    Try to change the scope from site to webapplication.
    Let me know please if the solution work with you or not
    Thanks for the comment.

  35. Narmadha

    April 7, 2011 at 9:48 am

    Hi Ahmed,

    Thanks for ur response….
    I tried as you mention but the same access denied error i got..Finally i activated the feature in “Power shell command” — Enable-SPFeature -Identity “FeatureName” -Url “http://abc:24131” .. issue got resolved.. One new thing is in timer jobs while activating the feature if access denied error is cuming then we can try to activate in powershell command..
    — Thanks

  36. sunny

    April 26, 2011 at 5:46 am

    greate work……..

  37. Osama

    May 8, 2011 at 12:16 pm


  38. Rashi

    June 7, 2011 at 8:54 am

    Nice post …
    A proper step by step explaination which makes it work fine without any errors

    Thanks for the post 🙂

  39. Jorge

    June 28, 2011 at 12:12 pm

    Great post… but I get a “Object reference not set to an instance of an object.” in line:

    SPWebApplication webApplication = this.Parent as SPWebApplication;

    In debug mode, I see that this.Parent is not null.

    Can anyone help me? Thanks!

    • Jorge

      June 29, 2011 at 7:11 am

      Ok, It was my fault xDD
      Everything is working fine now, thank you!!!

  40. Ahmed Naji

    June 29, 2011 at 8:35 am

    Thank you Jorge for your comment
    Ahmed Naji

  41. Joe

    August 8, 2011 at 4:35 pm

    Hello Ahmed,
    thanks very much for the post.
    however, i couldn’t get mine to work after following your guide step by step.
    first, the ListTimerJob did not appear on the list as indicated after deploying.
    second, after scrambling around on the sharepoint 2010 main site, i found this error log through List Central Admin>Check job status >List Timer Job (click on the failed link)

    Job Title List Timer Job
    Server mycomputer
    Web Application SharePoint – 80
    Content Database WSS_Content_71dc4-1d4a-46f
    Status Failed
    Completed 8/8/2011 5:27 PM
    Duration (hh:mm:ss) 0:00:00
    Error Message List ‘ListTimerJob’ does not exist at site with URL ‘http://mycomputer’.

    ‘ListTimerJob’ obviously deployed successfully and try changing the feature scope to other settings gave error as pointed out above.

    What is it that i may be doing wrong here?

    I need your kind and urgent assistance! Thanks!

  42. Ahmed Naji

    August 8, 2011 at 9:16 pm

    Hi Joe
    It’s obvious from error message the site with following url ‘http://mycomputer’ does not have ‘ListTimerJob’ List make sure please the list exist first the try to deploy the timer job.
    More information refer to the similar question on MSDN forums
    Hope that help.

  43. Joe

    August 10, 2011 at 8:47 am

    Hi Ahmed!
    thanks very much for the great post and prompt reply always! i found the links you provided helpful and was able to get the timer working by following a similar post here

    hope the ramadan fasting is going on well? 🙂


  44. Ahmed Naji

    August 10, 2011 at 12:28 pm

    Thank you very much Joe
    I’m very happy that you solved the problem of Timer Job and thank again for the link it will help a lot.
    Me too hope the ramadan fasting is going on well 🙂
    Best Regards.

  45. Kamogelo

    August 15, 2011 at 9:36 am

    Hi there Ahmed,

    Im using your custom Timer Job and was wondering how would I change it so that a workflow is started daily?

  46. Ahmed Naji

    August 16, 2011 at 8:14 am

    Hi Kamogelo
    It’s not a proper way to start Workflow daily from timer job.Workflow should run when you create new Item or update item.
    What you can do it associate workflow with list for example and then add item to the list by using timer job.
    Hope that help

  47. guruprasadmarathe

    August 26, 2011 at 3:39 pm

    hi ahmed,
    i have two timer job code is exactly as u hv mentioned bt and im running featureactivation code with runwithelevatedprivilages… both “site” scope
    both are similer timer jobs. im getting “object reference not set to…” to one of the timer job. but not to another timer job.. im wondering how its happening. one is SPMINUTESCHDELE another SPMONTHYSCHEDULe… minute is workin fine. bt not monthly..both are exactly same code..

    any feedback frm u?

  48. Ahmed Naji

    August 27, 2011 at 9:35 pm

    Hi guruprasadmarathe
    Actually it’s hard to say ,because as you said you just changed from minute to month .But what you can do is debugging the timer job.
    See the following code
    Hope that help

  49. Kamesh Bora

    September 19, 2011 at 4:58 pm

    Hi Ahmed,

    Good post. Helped me in creating the job very easily. But I have messed up with the logic. Is there a way to debug the job?


  50. Ahmed Naji

    September 19, 2011 at 7:33 pm

    Hi Kamesh Bora
    Yes you can debug the job,Check the following link

    • Kamesh Bora

      September 19, 2011 at 9:56 pm

      I am not able to debug the Execute method. It throws the below exception.
      List ‘ListTimerJob’ does not exist at site with URL

  51. Kamesh Bora

    September 19, 2011 at 10:04 pm


    I am able to start debugging by following your instructions in the link you mentioned and doing a IISReset.


  52. Kamesh Bora

    September 19, 2011 at 11:48 pm

    Hi Ahmed,

    I am stuck with one other issue. I do not have ListTimerJob in my site, but deployed the code with that reference. I have modified the code later to point to a different list which exists in my site.

    SPList Listjob = contentDb.Sites[0].RootWeb.Lists[“Idea1”];

    But it always throws a exception as “List ‘ListTimerJob’ does not exist at site with URL”. I have done the retract/IISRESET, but it did not work.

    Any help would be appriciated.


  53. Ahmed Naji

    September 20, 2011 at 6:13 am

    Try to retract the project and then deploy it again

  54. allan

    September 26, 2011 at 3:24 pm

    ya naji,
    everybody but me probably realized that the GUID in the event receiver from your article needed to be replace with the GUID that VS created for the feature found in the .feature file. If you don’t this error appears during deloy:
    rror occurred in deployment step ‘Add Solution’: Failed to create receiver object from assembly “CustomTimerJob, Version=, Culture=neutral, PublicKeyToken=174ee0646ba6df9f”, class “$SharePoint.Type.79f4ffaf-5cdd-4d4b-82f4-2ee3d7a866df.FullName$” for feature “CustomTimerJob_TimerFeature” (ID: ee65d232-8b7c-4492-826f-e821de5ab20c).: System.ArgumentNullException: Value cannot be null.
    Other than that it worked great.

  55. yasotha

    November 8, 2011 at 10:13 am


    I follwed the steps above to create a custom timer web part.
    But getting the following error

    Error occurred in deployment step ‘Activate Features’: Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain: An unexpected error has occurred.

    Any idea?

    • Ahmed Naji

      November 8, 2011 at 5:03 pm

      Hi yasotha
      You should deploy the timer job as a farm solution not sandbox solution

  56. addis

    November 14, 2011 at 10:24 pm

    deployed the solution without any error but i don’t see the list updated. what is the most likely problem

  57. Ahmed Naji

    November 16, 2011 at 5:24 am

    Hi addis
    Can you go to SharePoint 2010 central administration >Monitoring >in the Timer Jobs Section Select Review Job Definitions and see if the timer job exist or not.

  58. Mark Vogt

    November 17, 2011 at 4:23 am

    Greetings All,
    EXCELLENT article – gave me a great start on a timer job project that initially built, deployed and operated perfectly…
    …then suddenly I deployed this timer job successfully, but the timer job does NOT appear in the Job Definitions list at all !

    ANY ideas why a timer job would build & deploy apparently error-free, but suddenly start to NOT appear in the Job Definitions list (or other Job-related lists for that matter)?


  59. Annonymous

    November 19, 2011 at 2:00 am

    The best Post ever.. I am pretty new to sharepoint and love that this blog helped me configuring a custom timer job in one shot..Thanks much…

  60. bookworm

    December 15, 2011 at 1:34 pm

    im stuck with a problem here, the list is not populated, the service is started, from central administration i can see List Timer Job and i can see every 5 minutes it updates last run time. but the list is empty!!!!!can you help me for this pls?


    • Ahmed Naji

      December 15, 2011 at 7:03 pm

      Go to SharePoint 2010 central administration >Monitoring ->Click on the timer job then click run now .After that go to the event viewer->Windows Logs -> Application and see if there is some error message to help you.

  61. Thang Tran

    December 16, 2011 at 7:57 am

    I stuck with a prolem here. Timers job was failed. I debuged and it was exception in another source code out of Execute fuctions

  62. Lakshman

    December 29, 2011 at 7:53 am

    I tried it ,but I am getting the error Deployed Failed

  63. gksksgsezhain gk

    December 29, 2011 at 10:48 am

    After Doing all Restart sharepoint timer in windows Services.I struggled.

  64. Marian

    January 5, 2012 at 1:02 pm


    Indeed the code works great. But I have a little problem: If i try to modify the Execute method the job does the same thing, even if i delete Execute, it still runs the same. Please can you tell me how can I modify the Execute method and have the changes implemented into my job?

    Thank you,

  65. Khushi

    January 5, 2012 at 10:18 pm

    Hi Ahmed,
    I am trying to read configuration file of webapplication. I am able to read appsetting values but not able to read custom section data defined in the web.config. Can you please help me on this?
    System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(“/”, this.WebApplication.Name)

    I am looking the values of WebConfigurationManager.OpenWebConfiguration(“/”, this.WebApplication.Name) in watch window . but the object config is coming null. Could not figure out why?


  66. Sanjoy

    January 13, 2012 at 8:46 am

    I am using form based authentication …only problem is that when I try to create or update job its showing access denied error

  67. Clyde Ford

    January 22, 2012 at 11:28 pm


    I’m back with the same question I asked over a year ago, and have been searching unsuccessfully for over a year for. We are going into production now, and I’m wondering if you have any thoughts about programmatically adding a description to a timer job. Here’s my previous question:

    Thanks for this post. One question I have searched everywhere for but found no answer: Where do you specify a value that appears in the timer job definition page to the right of the field “Job Description?”

    You cannot do this:

    listLoggerJob.Description = “My job description”;

    because the member is “read-only”

    You cannot use the Description attribute of the Feature definition in feature.xml because that does not appear in the job definition.

    Any thoughts?

  68. Prachi

    January 31, 2012 at 12:58 pm

    Nice straight forward example. Thank you

  69. jassi

    February 15, 2012 at 9:21 am


    I have created a timer job and it is deployed successfully but in job History it is displaying

    duration = 00:00:00 and status=Succeeded

    i have also try to debug my execute method by using system.diagnostics.debugger.break();

    but still it is not working.

    Any help is appreciated



  70. Australian job search

    March 8, 2012 at 9:25 am

    I needed to thank you for this great read!! I definitely enjoyed every little bit of it. I have got you book marked to look at new things you post…

    • Ahmed Naji

      March 8, 2012 at 6:26 pm

      Thank’s a lot
      Glad to hear this from you.

  71. free credit scores without credit card credit scores and what they mean

    March 13, 2012 at 8:08 am

    Great post! We will be linking to this particularly great content on our website. Keep up the great writing.

  72. IT jobs

    March 15, 2012 at 6:47 am

    Does this really work?
    Can you give me a link for a free trial so I can test it out. Thanks.

  73. raj

    March 16, 2012 at 10:14 am

    Great code worked first time !

    Rather than create a list I would like to kick of a workflow, I found some code but dont know where to put it in this example and help appreciated.
    SPWorkflowAssociation wrkFl = list.WorkflowAssociations[new Guid(“2f9501e0-6762-4c0d-b092-9ea765a3cd7f”)];

    siteCollection.WorkflowManager.StartWorkflow(item, wrkFl, wrkFl.AssociationData, true);

    • Ahmed Naji

      March 17, 2012 at 5:37 am

      Hi raj
      Try to use it in the Execute method

  74. build list

    March 26, 2012 at 8:10 pm

    It’s hard to come by well-informed people about this topic, however, you sound like you know what you’re talking about! Thanks

  75. Thoma

    April 24, 2012 at 4:04 pm

    I’ve tried to do as you said, but i come to this error :
    Error occurred in deployment step ‘Activate Features’: Object reference not set to an instance of an object.

    I’ve thought it was because my scope was Web, but no, it’s Site.
    The error occurs during the : listLoggerJob.Update();

    Do you have any idea where it comes from ?

    Thanks for your answer

  76. Daryl

    May 3, 2012 at 1:16 pm

    Great post, steps work 100%, nice and simple to follow.

  77. R2C3

    May 4, 2012 at 9:39 am

    Thanks for the great post and its a day saver.

    Only issue I have it failed when deployed to subsite.
    In the CustomTimerJob properties I change the properties Site URL to http:/mysharepoint/projects/mysite/mypackage/ but nothing is showing in the subsite Lists


  78. Raed

    May 21, 2012 at 10:30 am

    Thanks ahmad , worked first time

  79. Raed

    May 22, 2012 at 12:26 pm

    Another note for people who unable to debug the timer job , I struggled for one day trying to debug and after deploying the solution in debug version , restarting the timer service , make a break point it would be stop in my break point, finally I change the class to “public” then I been able to debug it

    • Raed

      May 22, 2012 at 1:37 pm

      I need to correct this informat that came from our developer for public knowledge the reason was some additional DLLs in timer job was used and not registered to GAC so the job was failed …..sorry for being hary in writing info.

  80. IT Jobs

    May 29, 2012 at 7:24 pm

    You need to be a part of a contest for one of the best websites on the web. I will recommend this site!

    • Ahmed Naji

      May 30, 2012 at 9:27 am

      It’s really great to hear this.
      Thank you so much

  81. website

    June 6, 2012 at 6:34 am

    The design for the website is a little bit off in Epiphany. Nevertheless I like your website. I may need to install a normal web browser just to enjoy it.

  82. raj

    June 8, 2012 at 4:50 pm

    Great tutorial. How can you instantiate this timer job a number of times . i.e. create multiple copies of timer job with differing names? I think it can be done via the feature but need some help on this.

  83. Ninel

    June 12, 2012 at 6:36 pm

    Please help….
    I followed exact directions and when I deploy I receive the following error:
    “Error 1 Error occurred in deployment step ‘Add Solution’: Failed to create receiver object from assembly “Custom_TimerJob, Version=, Culture=neutral, PublicKeyToken=5569a5cb15f7da67”, class “$SharePoint.Type.10a3b8c8-44b4-41f5-ba7e-62ff305062d8.FullName$” for feature “Custom_TimerJob_Feature1″ (ID: 61a6a0be-382f-460f-b1a1-4bd41bcd73af).: System.ArgumentNullException: Value cannot be null.
    Parameter name: type
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
    0 0 Custom_TimerJob”

    I have this code in the event receiver:
    namespace DotnetFinder.Features.Feature1
    public class Feature1EventReceiver : SPFeatureReceiver
    const string List_JOB_NAME = “ListLogger”;
    // Uncomment the method below to handle the event raised after a feature has been activated.

    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 == List_JOB_NAME)



    What am I doing wrong???

  84. lorganisateur

    July 11, 2012 at 9:36 am

    Thanks for this post! simple et très efficace

  85. niranjanrao

    August 14, 2012 at 3:25 pm

    Thanks for the post…i have a question, i need to run other timer job inside my custom timerjob, can u give me ideas how to implement in execute code block of my custom timerjob

  86. snreddy

    September 1, 2012 at 11:23 am

  87. muscle groups

    September 16, 2012 at 10:56 am

    I do not know if it’s just me or if perhaps everybody else experiencing problems with your blog. It appears as if some of the written text in your content are running off the screen. Can somebody else please comment and let me know if this is happening to them too? This may be a issue with my browser because I’ve had this happen previously.

    • Ahmed Naji

      September 16, 2012 at 12:05 pm

      Actually I’m not facing any issue while browsing the blog.It work fine in most browser like IE,Firefox and Chrome.Try to use different browser may it work

  88. Amit

    September 25, 2012 at 7:46 am

    Realy Helpful post

  89. Jasi

    November 6, 2012 at 7:11 am

    Thanx for this post…

  90. oguzhanicdem

    January 24, 2013 at 12:00 pm

    i m new at this issue and visual stuido . Sorry for my little knowledge . i have some ques about thiss issue

    – which codes, where we will deploy
    – and where we will deploy from menü
    pls help to do this

    • Ahmed Naji

      January 26, 2013 at 5:58 am

      Try to download the sample then follow the steps mentioned in the article.

  91. Livin

    February 14, 2013 at 10:55 am

    Thanks for this post..

  92. renovations

    February 19, 2013 at 4:44 pm

    I’m excited to find this great site. I need to to thank you for your time just for this fantastic read!! I definitely savored every little bit of it and i also have you book-marked to look at new things in your web site.

    • Ahmed Naji

      February 19, 2013 at 6:15 pm

      Glad you like it.

  93. psylion

    March 25, 2013 at 2:33 pm

    It work like a charm when I deploy directly to the local instance.
    What are the steps to deploy to another server using PowerShell?
    I have modified the Site Url before the Package in Realease mode. but on the other server add-SPSolution or Install-SPSolution fails…Can you provide some guidance on how to deploy a site scope timerjob?

    Thanks in advance

  94. Tom Kossmann

    March 26, 2013 at 1:33 pm

    Excellent Tutorial! Helped me a lot on TimerJob-creation.

    I wrote a little article on my site for everyone struggling with “access denied”-behaviour:

    Best Regards
    Tom Kossmann

  95. Madhu

    April 4, 2013 at 11:48 am

    Thank you Ahamad Naji,
    I have used your code as it ease and deploy it without errors but in “ListTimerJob” list items are not added .
    how can solve this problem.


  96. Madhu

    April 4, 2013 at 3:48 pm

    i got below exception
    List ‘ListTimerJob’ does not exist at site with URL ‘http://lg0189/sites/blogs’.

    but i try to modify list values daily using timer can i avoid Blogs from my url.


    April 28, 2013 at 5:00 am

    You actually make it appear so easy with your presentation
    but I to find this topic to be actually something
    that I think I might never understand. It sort of feels
    too complex and extremely huge for me. I am looking forward on your subsequent publish, I will try to
    get the dangle of it!

  98. onetidbit

    April 30, 2013 at 11:08 am

    Ahmed Naji Thanks Bhayya for post.

    I am getting the problem like this ..

    Error 1 Error occurred in deployment step ‘Activate Features’: An object of the type SharePointProject3.ListTimerjob named “ListLogger1” already exists under the parent Microsoft.SharePoint.Administration.SPWebApplication named “SharePoint – 80”. Rename your object or delete the existing object.
    0 0 SharePointProject3


    May 2, 2013 at 11:09 pm

    And i have to admit ive lost 9 pounds, drowning myself in 2 liters of water a
    day. After all, no newspaper or magazine would willingly put their name to a
    weight loss tablet for yourself. However, prescription pure green coffee bean extract reviews are clinically tested and proven for
    safe use nor are their chemical structure conducive
    for human consumption. Green tea is an herbal beverage made from the dried leaves are also
    an option you can check out for losing weight. This combination
    will help to live healthy life.

  100. Anurag

    June 8, 2013 at 11:51 am

    Very nice and helpful article…… Thanks for sharing… 🙂

  101. Ayush

    September 23, 2013 at 11:57 am

    Your solution deployed succesfully and I also created on list name ListTimerJob but no item is added.

    Job Title- List Timer Job
    Server -********
    Web Application SharePoint – 2550
    Content Database-WSS_Content_2550
    Status- Failed
    Completed -9/23/2013 5:24 PM
    Duration (hh:mm:ss)-0:00:00
    Error -Message A new item is added into list.

  102. Ayush

    September 23, 2013 at 12:19 pm

    one more doubt -whenever I deployed the solution the ListTimerJob is automatically deleted from Sharepoint..
    How ?? Please help

  103. Jaideep

    July 25, 2014 at 4:50 pm

    Thank you so much………………..


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: