简体   繁体   English

是否可以通过编程方式进行“年度SharePoint计时器”作业?

[英]Is it possible to make a Yearly SharePoint timer job programmatically?

Even though I created a SharePoint timer job to run yearly. 即使我创建了一个SharePoint计时器作业以每年运行一次。 Once the timer job is executed manually through the central admin(After deploying it), the Schedule type changes to "Hourly". 通过中央管理员手动执行计时器作业后(部署后),计划类型将更改为“每小时”。 Then it gets executed hourly thereafter. 然后此后每小时执行一次。 Is it a bug in SharePoint 2013? 这是SharePoint 2013中的错误吗? What is the workaround for this problem? 解决此问题的方法是什么?

I had to do the same thing and i found a solution in changing the schedule to daily. 我不得不做同样的事情,我发现了将时间表更改为每日的解决方案。

Just check on Execute if it is the right date. 只需检查Execute是否正确即可。 This also has the advantages, that you can log it ('Timer Job runs' or something similar) to the ULS and check if your job keeps running. 这也具有优势,您可以将其记录到(“计时器作业运行”或类似的内容)到ULS,并检查作业是否继续运行。 I know, that it will run 365 times but only executes one time, but like i mentioned you can add a control mechanism. 我知道,它将运行365次,但只能执行一次,但是就像我提到的,您可以添加一种控制机制。 (And i had to execute on two days in a year so monthly wasn't an option) (而且我一年必须执行两天,所以每月都不可以选择)

When you don't want to execute it daily, you can change it to Monthly. 当您不想每天执行时,可以将其更改为每月。 Yearly is not an option, so will still have to check the current date on execute. 不能选择“每年”,因此执行时仍必须检查当前日期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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