I have a custom timer job that kicks off a workflow on a items in a Custom list. When trying to activate it I encounter this error:

09/08/2015 11:16:26.93  w3wp.exe (0x1B170)                          0x1B828 SharePoint Foundation           General                         8nca    Verbose     Application error when access /_layouts/ManageFeatures.aspx, Error=Access denied.   at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()     at Microsoft.SharePoint.Administration.SPJobDefinition.Update()     at TimerJobToStartWorkflow.TimerJobToStartWorkflow.Feature1EventReceiver.CreateJob(SPSite site)     at TimerJobToStartWorkflow.TimerJobToStartWorkflow.Feature1EventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)     at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)     at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce)     at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePr... ad0fcfea-642b-4f62-9a25-36b05f497a2c
09/08/2015 11:16:26.93* w3wp.exe (0x1B170)                          0x1B828 SharePoint Foundation           General                         8nca    Verbose     ...opertyCollection properties, Boolean force, Boolean fMarkOnly)     at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, String featureName, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope)     at Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId, Boolean force, SPFeatureDefinitionScope featdefScope)     at Microsoft.SharePoint.WebControls.FeatureActivator.ActivateFeature(Guid featid, SPFeatureDefinitionScope featdefScope)     at Microsoft.SharePoint.WebControls.FeatureActivatorItem.BtnActivateFeature_Click(Object objSender, EventArgs evtargs)     at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventA...  ad0fcfea-642b-4f62-9a25-36b05f497a2c
09/08/2015 11:16:26.93* w3wp.exe (0x1B170)                          0x1B828 SharePoint Foundation           General                         8nca    Verbose     ...rgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at ASP._layouts_managefeatures_aspx.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ad0fcfea-642b-4f62-9a25-36b05f497a2c
09/08/2015 11:16:26.93  w3wp.exe (0x1B170)                          0x1B828 SharePoint Foundation           Runtime                         6615    Critical    Access denied.  ad0fcfea-642b-4f62-9a25-36b05f497a2c

So it is throwing an Access Denied error at the job.Update() line of the Event Receiver.

I tried setting the deployment config to "No Activation" but that didn't work. Should I have my Farm Account activate it?

Event Reveiver

  Public Overrides Sub FeatureActivated(properties As SPFeatureReceiverProperties)
            Dim site As SPSite = TryCast(properties.Feature.Parent, SPSite)
        End Sub
        Private Shared Sub DeleteJob(site As SPSite)
            For Each job As SPJobDefinition In site.WebApplication.JobDefinitions
                If job.Name = List_JOB_NAME Then
                End If
        End Sub
        Private Shared Sub CreateJob(site As SPSite)
            Dim job As New StartWorkflow(List_JOB_NAME, site.WebApplication)
            Dim schedule As New SPMinuteSchedule()
            schedule.BeginSecond = 0
            schedule.EndSecond = 1
            schedule.Interval = 5
            job.Schedule = schedule
        End Sub

2 Answers 2


Jobs are high-level artefacts that need to be deployed by a farm admin, or from the CA.
Trigering a job update (creation) from an end-user list (or feature) event receiver is not a good practice at all, and will fail in most cases (even with an elevated section, since the app pool has probably not farm admin privileges).

The good approach is to create a single job from a Web application (or farm) level feature ER.
Then, your job monitors (i.e. checks each time it runs) a queue (can be a technical list of "work items", or the business list itself, with a status on each item to identify whitch ones need to be processed by the job).
Or you can create a SPWorkItemJobDefinition, witch is a specilized kind of job, that implements a queue mechanism.


Sadly, you can't really create Timer Jobs inside a Feature Activating event scoped at a site collection or web site level. SharePoint 2010 introduced a security setting called remote administration security block. Quoting the Microsoft documentation

This feature explicitly blocks any modifications to the objects inheriting from SPPersistedObject in the Microsoft.SharePoint.Administration namespace and does not allow the content web applications to update the configuration database"

This means that your code won't run unless you disable this protection setting (which is something you may not be able to do at all - production environments security policies can be pretty strict). I personally suggest you move your timer job creation code to a web-application scoped feature and work up from there.

You may also have a look at this other question and reply of mine. The problem is somehow different there (creating a content db opposed to creating a timer job) but the root cause should be the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.