Expand Minimize

SMA290110: Consider different implementation of TimerJob

There is no direct replacment for TimerJobs in the App Model. Alternative approach performs regular running operations e.g. via CSOM, console application and Azure Web jobs.

CheckId SMA290110
TypeName TimerJobRecommendations
Severity CriticalWarning
Type Assembly

Full Trust Approach App Approach
Custom Timer Jobs written in managed code

Traditionally timer jobs have been written in managed code based upon Microsoft.SharePoint.Administration.SPJobDefinition. They can be controlled in central administration, and log to the Unified Logging Service/System Events tracker. They are used to perform repeated operations, that would either be too much to process in one go, or that the data provided may come in small chunks every now and then. They are used over event receivers, to create less strain on the server.

While there is no direct implementation of a timer job in the App Model, there are multiple ways creating a timed job using the App Model.

Azure Web Jobs

An Azure Web Job, for all intents and purposes is a timer job, that is not attached directly to the SharePoint farm. While authentication is required, it is actually processing and method of process is the same as the old style SharePoint Timer Jobs.

App as a Timer Job

Recommended by many, and with samples in the Office PNP source codes samples, it is very easy to create an independent timer job in the App Model.

Impact of Full Trust Approach Benefit of App Approach
Performance Issues

The SharePoint server can often have large amounts of data being processed by timer jobs at any one time. While the role of the SharePoint farm is to supply the data to users and to other applications, using the same resource to process the data can sometimes result in large performance deficits.

Seperation of Roles

The App Model enforces seperation of roles to a higher level, ensuring that custom components are seperate and cannot interfere with the running of the farm.

Disaster recovery

With less components deployed on the farm, disaster recovery plans become much simpler, and the turn around of activating a DR plan, is significantly reduced as the processing components of the farm, are separate. The other benefit is having no deployed files to the server, which means that only the content database is backed up, ensuring a faster and more accurate disaster recovery process overall.

Efforts and Benefits

Migration Impact Critical
Re-Design Effort High
Re-Development Effort Medium/High
Long Term Benefit High

Effort Drivers

  • Performance
  • Disaster Recovery
  • Not Migratible Directly

To suppress this violation in managed code add the following attribute to the method which contains the instruction (available since SPCAF version v5.2). Learn more about SuppressMessage here.

// Important: Ensure to have #define CODE_ANALYSIS at the beginning of your .cs file
[SuppressMessage("SPCAF.Rules.MigrationAssessment.AdvancedCustomizationsGroup", "SMA290110:TimerJobRecommendations", Justification = "Provide reason for suppression here")]
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.