SharePoint List data with SQL Server Reporting Services

SharePoint is becoming more populler every day, companies from around the world are starting using it as main intranet site of their headoffice.

update 16/5/2009
4- the fourth way is to map the list directly to a database (Well i didn’t wrote that because two things first it is redundancy, second it is hard to keep updating both the database and sharepoint lists when-ever any change happens to any record, but Mr. Allan seems to have a great solution for that in the comments which is “SLAM ” (http://slam.codeplex.com)
SLAM allows you to easily maintain SharePoint data by hooking up against lists (or content types!) and having the data automatically synchronized with SQL server in real time. Best of all, it converts SharePoint look-ups to associations (with any multiplicity, one to one, one to many, many to many) that you can easily built queries against.
Thanks a for letting us know about this tool
update 21/5/2009 :
Well this time i tried the 2nd way on production (it works very well while it is on my machine in visual studio) but if we need to add it to the reporting services server it didn’t work on my enviroment not sure if it works on other enviroments
sharepoint SPListItem
Shareponit SPListItem
Hello there, well to be honest I am not a fan of Microsoft technologies well any how I cannot live without my XP these days (one of the best things the big M have done), but SharePoint is completely different story. It has a lot of potentials and abilities and once I saw the first time I said to myself this will finish all of my working place’s problems. But I had a feeling something will be wrong in it. To be honest I have faced a lot of challenges many times I was surprised with what SharePoint provides and many many more times I was disappointed with its limitations. But thanks to friends and fellow bloggers who helped a lot out of the problems.
This time I was facing a very strange problem that I am even not sure if it is SharePoint problems or it is just our environment, I was not able to find any similar problem on the net so thought I could document it here.
SharePoint API provides a great API to access list items , search them, add, delete, and update them that save you the effort of reading list information from SharePoint’s database directly, and it is provided in a very nice way. But the updating I have had some strange issue with that I have solved now, but I couldn’t understand why I got it in the first place.
Here I will give you the basics of accessing items from SharePoint Lists and show the issue
To access a list is very simple make a variable and assign it the url where you see the list in the sharepoint
string strDashListRoot = “http://[Servername]/[subsite/subsite]/Lists/[list name]/AllItems.aspx“;// just copy past the link form your browser
Then from the link you can get the site and website and the list easily
using (SPSite site = new SPSite(strDashListRoot))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["listname"]; // do not forget to close the brakets after your code is done } }
Now here you can access the list items easily
String information=Lists.items[2][“fieldname”].toString(); // simply put the index of the item you need and then the field name that you want to show
Now the main thing here is when we want to change field of the list item we could do easily this
Lists.items[2][“fieldname”]= “myvalues”;
Lists.items[2].Update();
but that didn’t worked in our environment while doing the folling code worked !!!
SPListItem item = Lists.items[2];
item[“fieldname”]= “myvalues”;
item.Update();
Well may be that is something related to our environment but hope through this simple blog you know how to access and edit SPList items.
Read More
