so I tried the AddEvent SP out. It works fine.
However I read somewhere that this undocumented procedure might be a deprecated feature of SQL Server. (still available in my SQL Server 2012 SSRS)
So you should not get too attached
I would like to use this e.g. in my SQL Agent Jobs.
For this I need to mimimze my maintenance task, as I am not always around when someone is modifing the cache configurations (e.g. deleting one cache config and creating a new one), I don't know if the EventData-IDs might have changed.
So I created a little procedure that fetches all the subscriptions of an desired type (e.g. RefreshCache) and creates an AddEvent-Call for it.
I kept it simple, but feel free to put more effort into it. You can probably filter subscriptions that are still active and so on...
As it is encapsulated there is a change to modify what is triggered one's M$ replaces the AddEvent-Procedure with something new.
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
-- Author: Christian Terhart
-- Create date: 2013-02-18
-- Description: Trigger Report Scheduled Task
ALTER PROCEDURE dbo.usp_report_event_trigger
@report_name nvarchar(425) = NULL,
@report_path nvarchar(425) = '',
@report_action int = -1
/* ReportAction EventType
SET NOCOUNT ON;
DECLARE @exec_command nvarchar(4000) = '';
@exec_command + N'EXECUTE ReportServer.dbo.AddEvent @EventType=''' + sc.EventType + ''', @EventData='''+CONVERT(nvarchar(36), UPPER(rs.SubscriptionID))+N'''; '
FROM dbo.Catalog AS c
INNER JOIN dbo.ReportSchedule AS rs ON (c.ItemID = rs.ReportID AND rs.SubscriptionID IS NOT NULL)
INNER JOIN dbo.Schedule AS sc ON (rs.ScheduleID = sc.ScheduleID)
WHERE c.Name = @report_name
AND (c.Path = @report_path OR @report_path = '')
AND (rs.ReportAction = @report_action OR @report_action = -1)
EXECUTE sp_executesql @exec_command