Automatic subscription setup in SSRS

I have a very simple report in SSRS, which is a table with three columns, object name, customer account and expiration date.

In my report, I turn on the UserID filter to restrict data to only registered user client accounts.

I store user client accounts in a simple table with the domain \ alias | Client account fields that are populated from the SSIS package.

When a new nickname | association of customer accounts, I would also like to set up a report subscription for this alias so that they are notified when they are updated.

Is it possible?

I recently discovered a report server web service , and I think this might help. Can I set up new subscriptions here? Ideally, I would like to do this in my SSIS package when a new client account is identified.

Please also note: I do not believe that data-based signatures will work for several reasons:
1) I use the UserID parameter to filter the report
2) I would like users to be able to manage their subscription independently when they are created in the "My Subscriptions" section "

UPDATE
I was able to successfully create a subscription for myself using the web service (see below), and I'm still learning how to do this for other users, although this does not look good:

ReportingService2010SoapClient service = new ReportingService2010SoapClient();
service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
TrustedUserHeader userHeader = new TrustedUserHeader();

string desc = "Send to Document Library";
string eventType = "TimedSubscription";
string scheduleXml =
       @"<ScheduleDefinition>" +
        "   <StartDateTime>2010-11-30T08:00:00-08:00" +
        "   </StartDateTime>" +
        "   <WeeklyRecurrence>" +
        "      <WeeksInterval>1</WeeksInterval>" +
        "      <DaysOfWeek>" +
        "         <Monday>True</Monday>" +
        "      </DaysOfWeek>" +
        "   </WeeklyRecurrence>" +
        "</ScheduleDefinition>";

ParameterValue[] extensionParams = new ParameterValue[4];

extensionParams[0] = new ParameterValue();
extensionParams[0].Name = "TO";
extensionParams[0].Value = "my alias";

extensionParams[1] = new ParameterValue();
extensionParams[1].Name = "IncludeReport";
extensionParams[1].Value = "FALSE";

extensionParams[2] = new ParameterValue();
extensionParams[2].Name = "IncludeLink";
extensionParams[2].Value = "TRUE";

extensionParams[3] = new ParameterValue();
extensionParams[3].Name = "Subject";
extensionParams[3].Value = "@ReportName was executed at @ExecutionTime";



string matchData = scheduleXml;
ExtensionSettings extSettings = new ExtensionSettings();
extSettings.ParameterValues = extensionParams;
extSettings.Extension = "Report Server Email";

string id;
service.CreateSubscription(userHeader, "/report path/report name",
                            extSettings, desc, eventType, matchData, null, out id );

- , CreateSubscription, , .

NetworkCredential credentials = new NetworkCredential("alias", "", "userdomain");
service.ClientCredentials.Windows.ClientCredential = credentials;

, , , COM:

WindowsIdentity wi = new WindowsIdentity("alias@fqdn");
WindowsImpersonationContext ctx = null;
ctx = wi.Impersonate();
+3
2

, .

0

re: , :

1) UserID 2) , , " "

, , , , , .

1) - , . , Dreamweaver 10 .

2), , ,

0

Source: https://habr.com/ru/post/1777548/


All Articles