Using a SharePoint List as a Data Source in SQL Server Reporting Services 2008 R2
We are constantly getting requests to produce reports that include data from SharePoint lists. We have just started using SQL Server Reporting Services (SSRS) 2008 R2 and see that there is a new Microsoft SQL Server Reporting Services SharePoint List Data Extension. Can you provide an example of how this works?
The Microsoft SQL Server Reporting Services SharePoint List Data Extension that comes with SSRS 2008 R2 allows you to specify a SharePoint site or subsite as a Data Source, then create a Dataset that is based on a SharePoint list in that site or subsite. This new data extension allows you to access list data in SharePoint Foundation 2010, SharePoint Server 2010, Windows SharePoint Services 3.0, and Office SharePoint Server 2007 sites.
In this tip I will review the following steps required to develop a report that retrieves data from a SharePoint list:
- Create a Data Source
- Create a Dataset
- Layout the report
To begin create a new Report Server project using SQL Server Business Intelligence Development Studio (BIDS) that comes with SQL Server 2008 R2. Note that the SharePoint List Data Extension is a new feature with SQL Server 2008 R2; it is not available in prior versions of SQL Server. Add a report to the project. You should see the Report Data tree view with a Data Sources and Datasets node (in addition to the other nodes) as shown below:
Create a Data Source
When building a report that uses data in a SharePoint list, the Data Source Connection String property must be set to the URL of the SharePoint site or subsite that contains the list you want to use in your report. Right click on the Data Sources node in Report Data and select Add Data Source from the popup menu. Fill in the Data Source Properties General tab as shown below (specify the URL in the Connection string for your SharePoint site or subsite):
Click on Credentials and fill in the dialog as shown below:
Create a Dataset
Once you have a Data Source that points to the URL of a SharePoint site or subsite, the next step is to create a Dataset based on the Data Source. Right click on Datasets in Report Data and select Add Dataset from the popup menu. Fill in the dialog as shown below (select the Data Source created above):
Click on the Query Designer button to display the SharePoint lists in the SharePoint site specified in the Data Source. Select a list and some fields from the list as shown below (I chose an Announcements list):
Note that you can only select fields from one list. Click OK and you will be returned to the Dataset Properties dialog which is now complete:
The Query is displayed as XML and it shows the name of the list and the fields selected.
Layout the Report
The last step is to add a Table to the report designer from the Toolbox and drag/drop fields from the dataset to the table. The report layout is shown below with the fields selected from the Announcements list:
Click Preview to show the report in the designer:
- You can also use Shared Data Sources and Shared Datasets, which allow multiple reports to use these items.
- Take a look at the MSDN topic Getting Data from a SharePoint List Data Source Type for additional details; one of the limitations noted is that a dataset can only retrieve data from a single list.
About the author
View all my tips
Article Last Updated: 2010-07-22