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

When i tried to Activate Feature of Timer Job It returns error : Access Denied

Scope of Feature is "Site"..

private static void CreateJob(SPSite site)       
     TenderTimerJob job = new TenderTimerJob(JobName, site.WebApplication);
     job.Properties.Add("SiteCollectionUrl", site.Url);
     SPMinuteSchedule minutes = new SPMinuteSchedule();
     minutes.BeginSecond = 0;
     minutes.Interval = 30;
     minutes.EndSecond = 30;
     job.Schedule = minutes;
     job.Update(); //Error Generates here
    catch (Exception ex){
     string str = ex.Message.ToString();
share|improve this question
up vote 2 down vote accepted

When a timer job instance is created, it is persisted to the farm configuration database. Accessing this database for write purposes is a privileged operation; as a rule of thumb, only the farm service account (that is, the account under which OWSTIMER.EXE executes) or accounts that explicitly have the rights. So application pool account wouldn't work, as this this task requires farm level permissions. However, if you're developing in Visual Studio 2010 you can avoid automatic activation of features using Project-> Properties -> In the Active Deployment Configuration section select "No Activation"

share|improve this answer
Thank You Falak, – Torque Oct 17 '12 at 7:58
I also tried without SpSecurity and my account is registered as Farm service account.. But Still not Working..:( – Torque Oct 17 '12 at 8:05
Are you activating features using PowerShell or during development Visual Studio 2010? – Falak Mahmood Oct 17 '12 at 10:54
During Deployment from VS 2010.. right now it is not showing error while i deploy it.. but when i debug it and activate feature manually it is showing error "Access Denied".. – Torque Oct 17 '12 at 11:04
@FalakMahmood does this allow non-farm account users to activate the feature? I don't see how disabling Activation on deployment allows for activation down the line – PT_C Sep 8 '15 at 13:58

One thing to remember when you are using site-scoped or site collection–scoped Features to install the timer jobs: The account that does the scheduling must have write permissions to the configuration database of the server farm. Usually, the identity of the application pool that is hosting the SharePoint site does not have permissions on the configuration database.

Add the below function in the .cs file of timer job in which you can also find "Execute" function.

protected override bool HasAdditionalUpdateAccess()
       return true;

This will solve you "Access Denied" issue .

share|improve this answer

I ended up on this page as a result of a google search, but found this answer as well which helped me, summed up it says:

By default, attempting to instantiate a timer job from within the site collection context is going to fail. Attempting the operation in an elevated privilege block (via SPSecurity.RunWithElevatedPrivileges) is only going to result in the web application's application pool account context being used instead of the current user context; this only succeeds if the app pool account has rights to write to the farm configuration database.

for the full answer check

share|improve this answer

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.