So now I’m back after few months to write blog continue. I got a new project with Reporting Services, Analysis Services, and SharePoint. It is not the big challenge for development, but a challenge for deployment. I thought it is quite easy to use the code for it. It should only upload the files to Report library like as documents and then configure directly in item properties. That is all. But I was completely wrong. The reports are created in Visual Studio, and I won’t set the reports again in SharePoint.
I couldn’t find any information about uploading the SSRS report files to SharePoint using code. Good news I can show you how the report files can be upload and set properties using the code without manual configuration after deployment.
For example, there are some files for deployment. For this project, there are four different environments, and every month the reports are updated, or new reports are added.
Requirement
It needs four requirements for deployment:
- Reporting Services
- SharePoint “Bussiness Intelligence Center”
- Report Files (Reports, Shared Datasets, Shared Data Sources)
- ConnectionString and Account for Analysis Server or SQL Server
Please note the order of deployment:
- Connect to Reporting Service
- Upload all data source files and save all URLs and file name for dataset files
- Upload all dataset files and save all URLs and file name for report files
- Upload all report files and save all URLs and file name for publishing
- Publish all files in SharePoint libraries
Here is a draft overview of deployment:
Development
1. Connect to SharePoint Reporting Service
I used it for SharePoint 2010 with SQL Server 2012, that is why I used the class “ReportingService2010”.
Next step the Shared Data Sources files will be uploaded.
2. Upload Shared Data Sources file
Now the data sources file with the SQL definition is added to SharePoint. Next step is Dataset files.
3. Upload Shared Dataset file
The dataset file is uploaded and configured in SharePoint.
4. Upload Report files
A report file can have many dataset-files and many report-files as subreports. I won’t take care of deployment. My code should take my task and set correct properties for each report file.
I couldn’t show you complete code because it was created different classes for the deployment. I tried to write this code manually and hopefully, it is clear enough for you, and it works for your solution.