0

I am trying to leverage the ssrs webservice for our report sever in native mode to add a new datasource to all our current reports. I can return all the items available on the report server. I can get data sources and the info contained in them, but when I execute the GetItemReferences(path, 'DataSource') method for any report on the server, the body is always empty. Same if I try to get the datasets in the report.

According to the documentation for this method the first paramater needs to be the fully qualified url of the report path, but I have only recieved errors trying to specify the url and not the relative path that gets returned by my inital query for all the items. ie: '/TeamReports/Workstation_Information/Workstation Report Name'.

The user account I am using has ContentManager, Publisher and ReportBuilder role assigned at the top-level folder. I am stuck right now because I am unable to view what data sources are already set and change them if they do not match the new one i created.

Here is what I have written so far to do this.

from requests import Session
from zeep import Client, Settings
from zeep.transports import Transport
from requests_ntlm import HttpNtlmAuth
import urllib.parse

user = "Domain\\ReportAdmin"
password = "password"

baseurl = 'http://reportserver.domain.com/ReportServer/ReportService2010.asmx'

sess = Session()
sess.auth = HttpNtlmAuth(user, password)
sess.trust_env = False
settings = Settings(strict=False, xml_huge_tree=True)

itemtype = 'Report'
client = Client(wsdl=baseurl, transport=Transport(session=sess), settings=settings)
allitems = allitems = client.service.ListChildren('/', True)

for i in allitems['body']['CatalogItems']['CatalogItem']:
    if 'Test Folder' in i.Path and i.TypeName == 'Report':
        client.service.GetItemReferences(i.Path, 'DataSource')

I get the server header info returned and the following the body:

'body': {
        'ItemReferences': None
    }

All the reports I have tested reports have a report embedded data source added and Mutiple datasets, so I am confused why none are shown.

0 Answers0