简体   繁体   中英

SharePoint Farm Wide Custom Timer Job

I am trying to develop a custom timer job that is scoped at farm level rather than a web application level. Can someone provide me with some sample code. Also when I look at the constructor of SPJobDefinition I see the following constructor with the following parameters.

protected SPJobDefinition(string name, SPService service, SPServer server, SPJobLockType lockType);

I assume this is what I have to use to create a farm level job definition. What is the SPService used for?

You can pass any farm level service as parent, and locktype as None. while provisioning timer job. This will make your timer job to run on all servers where the service is running and your job will be run once per server. Example Job = new TestJob1("mytimerjob", "Instance of service", null, SPJobLockType.None); Instance of service can be : timer service, sharepoint foundation web application service"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM