如何在SharePoint中安排报表以在该月的最后一天运行?

时间:2022-10-16 12:10:44

I have several reports in SharePoint that are served by SQL Server Reporting Services in SharePoint Integrated mode. Some of these reports need to be automatically generated on the last day of the month. While SSRS itself has a "last day of month" option, SharePoint doesn't have this capability in its scheduling options.

我在SharePoint中有几个由SharePoint集成模式下的SQL Server Reporting Services提供服务的报表。其中一些报告需要在该月的最后一天自动生成。虽然SSRS本身具有“最后一天”选项,但SharePoint在其计划选项中没有此功能。

What is the best way to add this capability? I don't mind writing code, or installing something, or enabling something I don't know about.

添加此功能的最佳方法是什么?我不介意编写代码,安装某些东西,或启用我不知道的东西。

4 个解决方案

#1


SPMonthlySchedule can only run on a specific date. Afaik you cannot configure it to run on the last day of the month.

SPMonthlySchedule只能在特定日期运行。 Afaik你不能将它配置为在该月的最后一天运行。

I would create a timer job running daily, and doing the report if today is the last day of the month. Create a SPJobDefinition with a SPDailySchedule to achieve this.

我会创建一个每天运行的计时器作业,如果今天是该月的最后一天,则执行报告。使用SPDailySchedule创建SPJobDefinition来实现此目的。

Here is a howto.

这是一个howto。

if(DateTime.Now.Month != DateTime.Now.AddDays(1).Month)
{
 //Do report
}

#2


IMO, I would look into writing a Timer Job. I wrote one for a bi-weekly data import. I'm sure you could do an EOM report generation with it.

IMO,我会考虑编写一个Timer Job。我为一个双周数据导入写了一个。我相信你可以用它做一个EOM报告。

#3


Search google for SPMonthlySchedule (timer job class in the SharePoint object model).

在Google中搜索SPMonthlySchedule(SharePoint对象模型中的计时器作业类)。

#4


This is pretty old but I just had the same problem.

这已经很老了,但我遇到了同样的问题。

An easy way to do this is set up 3 subscriptions for the report.

一种简单的方法是为报告设置3个订阅。

Have one email out the report on the 31st of Jan, Mar, May, Jul, Aug, Oct, Dec Have one email out the report on the 30th of Apr, Jun, Sep, Nov Have one email out the report on the 28th of Feb

在1月,3月,5月,7月,8月,10月,12月31日有一封电子邮件发送报告在4月30日,6月,9月,11月有一封电子邮件在28日报告中有一封电子邮件二月

Note that this does not take leap years into consideration.

请注意,这不需要考虑闰年。

#1


SPMonthlySchedule can only run on a specific date. Afaik you cannot configure it to run on the last day of the month.

SPMonthlySchedule只能在特定日期运行。 Afaik你不能将它配置为在该月的最后一天运行。

I would create a timer job running daily, and doing the report if today is the last day of the month. Create a SPJobDefinition with a SPDailySchedule to achieve this.

我会创建一个每天运行的计时器作业,如果今天是该月的最后一天,则执行报告。使用SPDailySchedule创建SPJobDefinition来实现此目的。

Here is a howto.

这是一个howto。

if(DateTime.Now.Month != DateTime.Now.AddDays(1).Month)
{
 //Do report
}

#2


IMO, I would look into writing a Timer Job. I wrote one for a bi-weekly data import. I'm sure you could do an EOM report generation with it.

IMO,我会考虑编写一个Timer Job。我为一个双周数据导入写了一个。我相信你可以用它做一个EOM报告。

#3


Search google for SPMonthlySchedule (timer job class in the SharePoint object model).

在Google中搜索SPMonthlySchedule(SharePoint对象模型中的计时器作业类)。

#4


This is pretty old but I just had the same problem.

这已经很老了,但我遇到了同样的问题。

An easy way to do this is set up 3 subscriptions for the report.

一种简单的方法是为报告设置3个订阅。

Have one email out the report on the 31st of Jan, Mar, May, Jul, Aug, Oct, Dec Have one email out the report on the 30th of Apr, Jun, Sep, Nov Have one email out the report on the 28th of Feb

在1月,3月,5月,7月,8月,10月,12月31日有一封电子邮件发送报告在4月30日,6月,9月,11月有一封电子邮件在28日报告中有一封电子邮件二月

Note that this does not take leap years into consideration.

请注意,这不需要考虑闰年。