In this one, I will demonstrate how to use SQL Server Reporting Services (SSRS) to pull data from a Windows
SharePoint Services List using the web services interface. I have seen many reporting implementations whereby the developers opt to connect to the WSS content database directly and read their data using TSQL statements. this approach is not recommended for many reasons, the most obvious are that its not supported, also it poses scalability limitations in case you decided to scale out and use multiple content dbs, in such scenario you will need to modify your queries to connect to the correct content dbs. The database schema of WSS tables are not self descriptive and developers end up hard coding the mapping of WSS list columns to database table columns.
Using the WSS Web Service interface will encapsulate the knowledge of content dbs schema and location, the challenge with this approach is to get SSRS to learn how to connect to a WSS list.
To get SSRS designers to consume WSS Web Service there are a number of available options:
For this example, I am going query the "Style Library" list from the SharePoint site http://sharepoint/sites/mutaz
Start by creating a new data source, select type: XML and for the connection string use something similar to: http://sharepoint/sites/mutaz/_vti_bin/Lists.asmx, here I am using the Lists web services to retrieve the list items.
the connection string is two parts:
1. the site URL: http://sharepoint/sites/mutaz 2. the web service asmx file path: /_vti_bin/Lists.asmx
1. the site URL: http://sharepoint/sites/mutaz
2. the web service asmx file path: /_vti_bin/Lists.asmx
then in the data set query, the query string should specify the following information:
the Data Query XML will be:
<Query> <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction> <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems"> <Parameters> <Parameter Name="listName"> <DefaultValue>Style Library</DefaultValue> </Parameter> </Parameters> </Method> </Query>
executing the above data set query will retrieve the list items.
things become more challenging if you try to use this method to query multiple web sites or to change the website name at run time. for that I suggest to consider using a custom data extension.
cheers,
- mutaz