Using SSRS/SSIS to Report on SharePoint Data 

Tags:

Danny Sebestyen recently wrote up his experience with reporting on SharePoint data using SSRS and SSIS.  Thanks Danny!
 
To effectively report on SharePoint data using SQL Server Reporting Services (SSRS) you must copy the data into SQL Server using SSIS.  Unfortunately, SharePoint out of the box does not have a solution for reporting on its own data other than configuring list views or building data views.  Building a reporting database gives developers a powerful toolkit for building high-performance reports while off-loading the burden of report processing from SharePoint. 
 
So how do you get the SharePoint data loaded into SQL Server so reports can be built and executed in SSRS?  Simple, write an SSIS package that executes the following steps:
  • Executes a small custom utility to extract the SharePoint data to xml files using the built-in 'Lists' web service.
  • Delete the current reporting data in the database
  • Load each of the list's xml data files into the corresponding tables
  • Send e-mail notifying reporting data has been successfully loaded

Finished Control Flow Example

Finished Control Flow Example

Small Utility to the Generate the List XML Data Files (see the "Run SharePoint Extractor" task in the Control Flow above):

First create custom views for each SharePoint list to contain the data needed for reporting.  The views must be defined to return a set amount of records used for making multiple calls to get all the data from large lists .  Also, the views can be used to only extract the data needed for reports instead of all the data in the list.  Next, write a method named something like ExtractListData that takes the following parameters: string listName, string fileName, string elementName, string viewName.  The ExtractListData method basically makes a call to the SharePoint Lists' GetListItems method to retrieve the data.  Once you retrieve the data into the NodeListItems, then there are several important items that need to be done:

  1. Write out the root xml element
  2. Scrub all lookup values to other lists you only include the ID value, so you have to remove the #;<data value> from the columns value
  3. Scrub all the Person/Group values to only the data part of the value so you have to remove the ID and the "#;"
  4. Remove the z: from the z:row element name because the SSIS XML Source Data Flow Component will not load the data
  5. Convert any number values to integers if they are defined as integers in the database
  6. Write out the transformed rows
  7. Write out the ending root xml element

NOTE:  There are probably more types of transformations based on your data.

Delete the Data from the Reporting Tables (see the "Delete All Records" task in the Control Flow above):

The design is to completely delete all the data in the SQL Server reporting tables and then reload all the data from the xml data files generated above.    Since the entire process happens rather quickly I did not feel the need to do incremental updates based on my performance requirements, but may be needed if there is a tremendous amount of data in the SharePoint lists.  I basically had 16 lists where most lists were < 1000 records and one list with ~50,000 records.

Load Each List's XML Data Files:

To create the SSIS XML Source Data Flow Components you need an XML Schema file for each of the lists.  I just opened up the XML files generated above in Visual Studio 2005 and selected the XML->Create Schema item for a quick and dirty way to get the XML Schema.  The generated schema will need to cleaned up a little, such as setting lookups to xs:integer.

 

Create Schema

Now you can create a new SSIS Data Flow task and put an XML Source component in it.  Right-click and select Edit… on the XML Source to configure the settings including the schema file and the columns used to load the reporting database.

 

XML Source Editor

Next, drop a Row Count Data Flow Transformation and create a link between the XML Source and the Row Count tasks.  Next, drop an OLE DB Destination Data Flow Destination and configure it to connect to the reporting database and select the appropriate table.  You also need to link all the columns from the XML Source columns to the reporting database table columns to define where the data gets loaded.

 

Data Flow Task Example:

 

Data Flow Task Example

Send Email to Notify Successful Data Load:

 

Drop a Send Email Task on the control flow and link it to the last Data Flow task.  First, you will need to create an SMTP Connection to configure which email server to use to send the email.

 

 

Send Email

Next, right-click on the task and select Edit… and select the SMTP connection created above and fill out the rest of the email information.

 

Configure Send Email

 
Posted by Kirk Liemohn on 26-Jun-07
9 Comments  |  Trackback Url  |  Link to this post | Bookmark this post with:        
 

Links to this post

Comments


Setspn and Accounts commented on Friday, 9-Nov-2007
Thanks for the great tips but I have one question. With the setspn commands, our SQL server and the Sharepoint server all run as a local service and not a domain account. Your notes seem to use the setspn command against domain accounts. Does this mean that we have to run SQL etc under a domain account?


Response to Setspn and Accounts commented on Monday, 12-Nov-2007
My understanding is this; if your SQL server and SharePoint server are on seperate systems then you will need to configure them to run as domain accounts. You will need to do this so you can enable kerberos delegation. This allows the SharePoint server to forward the user credentials to the SQL server.


Kevin Idzi commented on Wednesday, 20-Aug-2008
There is now a public component you can use that treats Sharepoint as a SSIS Datasource, so you do not have to use XML and the scrubbing mentioned above anymore.


Kevin Idzi commented on Wednesday, 20-Aug-2008
There is now a public component you can use that treats Sharepoint as a SSIS Datasource, so you do not have to use XML and the scrubbing mentioned above anymore. Codeplex Sharepoint Adapters: http://www.codeplex.com/SQLSrvIntegrationSrv


堀北真希 commented on Monday, 6-Oct-2008
nice site. thanks.


wow commented on Thursday, 30-Oct-2008
lc Welcome to wow gold. We are a world class wow powerleveling store online. We supply cheap wow gold to our loyal and World of Warcraft goldreliable customers. you canwow power leveling buy really cheapwow gold wow gold here. We havewow power leveling mass available stock ofwow power leveling wow gold onwow power leveling most of the servers, sowow power leveling that we can do aRolex really instant way of wow power levelingwow gold wow golddelivery. We canwow powerleveling deliver yourwow powerleveling wow gold on powerlevelingthe order powerlevelingin a short cheap wow goldwhile. We have beencheap wow gold an ebay powerpower leveling seller and paypalpower leveling confirmed seller rolex replicaof wow gold for replica rolexyears.So it ischeap wow gold securest and safestRunescape Gold to buy RuneScape Money wow gold from Watches Rolexus. Don’t be Rolex Watchesirresolute! We arewow gold hoping to servegold wow you and helpingWatch Rolex you to have a wonderfulRolex Watch wow life! We arers gold ready now, how about you?


car wash commented on Monday, 29-Dec-2008

car wash commented on Monday, 29-Dec-2008
Pursestock supplier provides the best Gucci replica,Chanel replica,Louis Vuitton replica; show you every detail of photos of replica handbags. Do you think it is hard to believe that we have such a high-quality wholesale replica handbags,Hermes birkinand Hermes kelly? Let me tell you, when you have our Gucci replica purses, you will understand why Chinese manufacturing industry and replicas products are so well-developed. The authentic Gucci replica, you can buy for collections. But the genuine high prices are outrageous, how many collections you can buy with such a high price,if you like Monogram Canvas,speedy 30,chanel 2.55 bag ? Jadeshow’s replica Tiffany Jewelry and Replica Bvlgari Jewelery looks just like the real thing. Why pay more for a single piece of Tiffany Replica jewelry,Bvlgari Replica Jewelry when you can treat yourself to a number of replica pieces for the same price or less? Be simply spectacular with contemporary Tiffany-inspired jewelry!Jadwshow delights in the opportunity to offer our customers fine Tiffany Bracelets, Tiffany Necklaces, Tiffany Earrings, Tiffany Rings, Tiffany Bangles,Gucci jewelry replica, all at remarkably low prices.

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation