Archive for October, 2009

You can use SharePoint lists as a datasource not through the database but via the SharePoint web services. The SharePoint web services can be found in the _vti_bin directory of each SharePoint web application and the web service you want to interrogate to get at Lists is called lists.asmx.

Here is how you do it.

1. Start VS 2005 and create a new Reporting Services project.
2. Add a Shared Datasource and make it of type XML, then add the url to the web service: e.g. http://domainname/_vti_bin/lists.asmx
3. Create a new report and select the datasource as the one you created
4. Now enter the following query string


<Method Namespace=”; Name=”GetListItems”>













<ElementPath IgnoreNamespaces=”True”>*</ElementPath>


Once you added this as your query string you should see a list of fields which you can add to your report. Note that SSRS doesn’t recognise the data type of the fields and everything returned is treated as a string. Use the CInt and CDate functions (and the other converstion functions) to convert the data into the correct format – particularly if you want to include totals in your reports.

The ‘lookup’ and ‘people and groups’ fields are of the format 99#;text where 99 is the ID. To handle this goto Visual Studio, select the Report menu -> Report Properties and select the Code tab and then embed a function to strip off the stuff you don’t need. You can fine more details for writing code here.

Now Click on the Layout tab. Insert a table or a chart from the toolbox and in the left hand side you will find a Dockable bar with name “Dataset” from where you will find all the columns from the which you can add to your report.
Here parameters listName refers to the GUID of the list you need to access and viewName refers to which view of the list you need. rowLimit is the number of items you need and the order will be same as in the list.


Posted: October 23, 2009 in Toolpart

I have already created a post oncreating a toolpart.

There is a more simpler way to provide a toolpart and to read values from it.

You just need to do two things

  • Create a property of the required type.
  • access that property same as a normal variable.

For Example in the below code I am getting a string variable and displaying that in the label in the webpart.

public partial class CFReport : System.Web.UI.UserControl
         public string UserName
              get { return userName; }
              set { userName = value; }
        protected void Page_Load(object sender, EventArgs e)

             this.lblName.Text = this.UserName;

Here UserName will be a property that will appear in the toolpart and here the value that is entered will be displayed in the label.

If you want to create an event handler for a list in sharepoint you need the template Id of that particular list. Here are the list of Id’s

GenericList 100
DocumentLibrary 101
Survey 102
Links 103
Announcements 104
Contacts 105
Events 106
Tasks 107
DiscussionBoard 108
PictureLibrary 109
DataSources 110
WebTemplateCatalog 111
UserInformation 112
WebPartCatalog 113
ListTemplateCatalog 114
XMLForm 115
MasterPageCatalog 116
NoCodeWorkflows 117
WorkflowProcess 118
WebPageLibrary 119
CustomGrid 120
DataConnectionLibrary 130
WorkflowHistory 140
GanttTasks 150
Meetings 200
Agenda 201
MeetingUser 202
Decision 204
MeetingObjective 207
TextBox 210
ThingsToBring 211
HomePageLibrary 212
Posts 301
Comments 302
Categories 303
IssueTracking 1100
AdminTasks 1200