Saturday, January 25, 2020

Data Driven Subscription Email Setup Notes

I wanted to deliver data-driven subscriptions via email. Here's how I used my Office 365 account for the smtp server:

Server Address: smtp.office365.com
Port Number: 587

The Report Server Configuration Manager's E-mail settings doesn't allow you to enter the STMP port number. I had to open up the rsreportserver.config file and enter it. I'm using SSRS 2019 and I found the rsreportserver.config file in the folder C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\ReportServer.

Find the <Extension Name="Report Server Email" section and set <SMTPServerPort>587</SMTPServerPort>

Friday, January 3, 2020

Generate T-SQL to Manually Execute Report Subscriptions


DECLARE @sql varchar(max);

set @sql = '';

select @sql = @sql + 'exec ReportServer.dbo.AddEvent @EventType=''TimedSubscription'', @EventData=''' 
 + cast(Subscriptions.SubscriptionID as varchar(500)) + ''';' + '--- '+ [catalog].name + CHAR(13) 
FROM ReportSchedule 
 INNER JOIN Schedule ON ReportSchedule.ScheduleID = Schedule.ScheduleID 
 INNER JOIN Subscriptions ON ReportSchedule.SubscriptionID = Subscriptions.SubscriptionID 
 INNER JOIN [Catalog] ON ReportSchedule.ReportID = [Catalog].ItemID 
 AND Subscriptions.Report_OID = [Catalog].ItemID
 WHERE Subscriptions.DeliveryExtension = 'Report Server Email'
 -- show only failed
 --and LEFT (subscriptions.LastStatus, 12) != 'Mail sent to'
 --and convert(varchar(20),Subscriptions.lastruntime, 101) = convert(varchar(20),getdate(), 101);

--EXEC(@sql);
print @sql​