2

I have been playing with the SharePoint Client Object Model today and have been able to connect to my department's SharePoint site and list items (SSRS reports) found within a specific library using the follow code in a console app:

        ClientContext ctx = new ClientContext("http://sitename.ca");
        List lst = ctx.Web.Lists.GetByTitle("Departmentals");

        CamlQuery cq = CamlQuery.CreateAllItemsQuery();
        ListItemCollection lic = lst.GetItems(cq);
        ctx.Load(lic, items => items.IncludeWithDefaultProperties(item => item["Report_x0020_Description"], item => item.DisplayName));

        ctx.ExecuteQuery();

        foreach (ListItem l in lic)
        {
            Console.WriteLine(l.DisplayName + ": " + l["Report_x0020_Description"]);
        }
        Console.ReadLine();

This code lists all SSRS reports and the custom description field but I can not figure out how to access things other than "columns" in my SharePoint list from the item. Can anyone point me in the direction of how to access the datasource attached to an ssrs report? In particular I need to determine if it is using a shared datasource or a custom datasource and list the username stored within the datasource if it is a custom one. Any help apreciated, thanks.

  • Did you found a way to perform this ? we are looking for a way to perform a Mass update of both Report datasource connections and to edit the Datasource definition – Mike Feb 22 '18 at 14:51
  • Sorry @Erin, I don't believe the problem was solved with this technique and I've left that job now. – Daniel Feb 23 '18 at 16:47
  • i've found a way to connect to them using the SSRS web service, I'll add an answer for future reference – Mike Feb 23 '18 at 16:59
0

You can get and edit both Datasource Information and DataSource definitions from Sources and Reports with the ReportServer web Service.

The url to the web service tipically is for SP2010 and above:

SharePonitSite/_vti_bin/ReportServer/reportservice2010.asmx

For SSRS For SharePoint below 2010 the address is:

sharePoint Site/_vti_bin/ReportServer/reportservice2006.asmx

Once you have added the Web Service Reference to your proyect you can create an instance of it and use all of the provided Methods

in specific the methods you need are:

GetDataSourceContents("Datasource URL);

and

GetItemDataSources("Report URL")

Example :

C# Code : RSService.ReportingService2010 RSService = new RSService.ReportingService2010(); RSService.Credentials = System.Net.CredentialCache.DefaultCredentials; var Datasource = RS2013Service.GetDataSourceContents("DSPath");

with these lines "DataSource" contains all the DataSource Information

You would still need to use CSOM to extract your Datasource URLS, but once you have them, you can request the SSRS Web Service to get the report information

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.