December 10, 2010

SharePoint List as Data source to SSRS Report.

Hi,

While working I had one requirment that we have to create one SSRS Report which has datasource as SharePoint List.

I found that SQL 2008 BI tools provides SharePoint List as datasource but for SQL 2005 we dont have such thing.

After lot more search I found a solution to meet the requirment.

 Steps:
1) Create a SSRS Report Project in Visual Studio.
2) In Data Source create a shared Data Source Type = XML
3) Give the connection string as http://<siteurl>/_vti_bin/Lists.asmx
4) Create a new dataset for the data source.
5) Provide the query string as,

<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>{4D1E6A08-6576-4CAB-96AA-AF251CEC3FA6}</DefaultValue></Parameter>
<Parameter Name="viewName"><DefaultValue&gt;{FA450965-8535-468A-840C-20F28D12CCB1}</DefaultValue></Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="True">*</ElementPath>
</Query>


This query string has red maked numbers are the List GUID and View GUID, you can get those ID's from SharePoint List and view of that list.
 
6) Now the dataset is created just execute the Query.
7) If the Query is executed sucessfully then design the Report.