Programmatically add subscription to SSRS reports

2019-05-31 05:39发布

问题:

On my SSRS server I have folder structure like

  • folder1
    • subfolder1
      • report1
    • report2
  • folder2
    • some_other_report2
    • report3
  • folder3
    • report4

I want to that these reports should be copied to client machine according to the same directory structure at a given schedule. I know this can be done by individually adding subscription to each report. But I was looking for a way so that I can programmatically ( using scripting or some tool) add subscription to all the report at one go. Also, if possible, it can be used for other clients as well in the future.

PS: I have searched on SO but the question appears to be old and does not solve my purpose either.

回答1:

I believe it can be done using the SSRS web services the following steps are how I'd do it (sorry no time to code it for you):

  1. After getting a reference to the web service client, invoke ListChildren, supplying the recursive parameter to walk the directory structure.
  2. At each report node, call the CreateSubscription method, with appropriate parameters to dump to files.