Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.


I have created custom timer job and successfully deploy it into SP. I see this timer job and feature on the lists. Job is being called every 10 minutes with status "succeeded". Issue is that Execute method is not being called. This is part of my code:

public override void Execute(Guid targetInstanceId)
    {
        System.IO.File.AppendAllText(@"C:\Temp\Timer.txt", "Copy Documents Timer Job Execute: " + DateTime.Now.ToString() + "\r\n");
    }

I'm writing logs to Timer.txt file in constructor too, and constructor code is being executed. Question: Why Execute method is not being called? What I'm doing wrong?

share|improve this question

2 Answers 2

SharePoint timer jobs run in the context of the SharePoint Timer V4 service. Hence, SharePoint will not pick up changes for dll's loaded by this service, unless you either 1. Increment version of your assembly, or 2. Restart SharePoint Timer V4 service

share|improve this answer

Probably due to the timer process having insuffient rights to write to the directory. The constructor is being called when you create the timer job, which is done with a farm administrator account which is probably a local administrator too (so it does have rights to write).

Check the account the timer service runs under and see if that has sufficient rights to the folder.

share|improve this answer
    
Even when I delete write to file line, rest of code is not being executed. Basically this job is scanning some document libraries to find some documents. So there is not required any extra access level. –  porterneon Feb 29 '12 at 12:58
    
Could you check the ULS logs if there are any errors listed there? Execute is the only thing a job does, so it either works or it doesn't. If it doesn't work there's bound to be something written in the ULS logs. –  Jasper Feb 29 '12 at 13:21
    
This is appearing when job is being executed: Site Enumeration Stack: at Microsoft.SharePoint.SPBaseCollection.GetEnumerator() at SP2010_CopyDocs.CopyDocsJob.Execute(Guid targetInstanceID) at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinit‌​ion jd, Guid targetInstanceId, Boolean isTimerService, Int32& result) at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result) –  porterneon Feb 29 '12 at 13:36
2  
restart SharePoint Timer service solved all issues. –  porterneon Feb 29 '12 at 14:19
2  
LOL, yeah that's a requirement too ;) Your fresh GAC DLLs won't be loaded untill you restart the timer service. –  Jasper Feb 29 '12 at 14:41

Your Answer

 
discard

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.