Category Archives: Technology

Interacting with SharePoint using WebService

In a typical developer guide, one will interact with SharePoint using SharePoint object model, i.e.  Using SharePoint libraries and then deploying code on SharePoint server.

However ever wondered what if one will not have execute permission on SharePoint server and still need to build a webpage which will be hosted on SharePoint and pulls data from libraries?

Here SharePoint Web services comes to rescue, SharePoint has their built-in Web service which allows users to access data without using SharePoint libraries. These Web service are usually found at http://<server-url>/_vti_bin/lists.asmx one can either add them as web reference or consume them using JavaScript Ajax

Below are some web services data which I managed to pull out.

Web Services Description URL
Administration Service This Web service provides administrative capabilities like creating a new top-level site, deleting a top-level site and getting the list of available languages. http:///_vti_adm/admin.asmx
Alerts Service Provides access to the list of active alerts and allows to delete active alerts. http:///_vti_bin/alerts.asmx
Document Workspace Service This Web service is used to manage Document Workspace sites. It allows you to create new document workspaces, delete document workspaces, create new sub-folders, delete sub-folders, and so forth. http:///_vti_bin/dws.asmx
Forms Service Each list has forms associated which are used to display list items, create new list items, and update or delete existing list items. This Web service allows to get the collection of forms associated with a list and then get detailed information about each form. http:///_vti_bin/forms.asmx
Imaging Service SharePoint has picture libraries that users can use to manage pictures. This Web service allows to upload pictures, download pictures, create new folders, delete folders and pictures, and the like. http:///_vti_bin/imaging.asmx
List Data Retrieval Service Allows you to run XPath like queries against a list. http:///_vti_bin/dspsts.asmx
Lists Service This Web service is used to work with lists and list data. You can obtain the collection of lists, add new lists, remove lists, add new list attachments, remove attachments, and so on. http:///_vti_bin/lists.asmx
Meetings Service This Web service is used to work with Meeting Workspaces. You can create a new Meeting workspace, remove an existing Meeting workspace, add new meetings, add new meetings using ICal files, and so forth. http:///_vti_bin/meetings.asmx
Permissions Service Sites and lists have permissions assigned to them. This Web service is used to obtain the permissions assigned to a list or site, add new permissions, and update or removing existing permissions. http:///_vti_bin/permissions.asmx
Site Data Service The Site Data Web service can be used to return meta-data about a site or list, get the collection of lists, get the attachments for a list item, get the collection of items in a list, and so on. http:///_vti_bin/sitedata.asmx
Site Service This Web service can be used to return the list of site templates. When you create a new site using the Administration Web service you need to specify the site template name to use that you can obtain through this Web service. http:///_vti_bin/sites.asmx
Users and Groups Service This Web service is used to work with users, site-groups and cross-site groups. You can add, update or remove users, site-groups, and cross-site groups. You can also add users or cross-site-groups to a site-group. http:///_vti_bin/usergroup.asmx
Versions Service Document Libraries and Picture Libraries can have versioning enabled, which stores a copy of every single file version. This Web service can be used to get the list of available versions, delete versions, and also restore a file version. http:///_vti_bin/versions.asmx
Views Service Lists have views associated that define what fields are shown, what filtering and sorting is applied, what grouping is applied, and so on. This Web service is used to work with list views. You can get the collection of views, add new views, remove views, update the Html code used to display a view, and the like. http:///_vti_bin/views
Web Part Pages Service Web Parts are objects that you can place on Web part pages. This Web service is used to work with Web parts and Web part pages. You can get the list of Web parts on a page, you can add or remove Web parts, and so forth. http:///_vti_bin/webpartpages.asmx
Webs Service This Web service is used to work with sites and sub-sites. You can get the list of list-templates, get meta-data about a sub-site, get the list of sub-sites, and so on. http:///_vti_bin/webs.asmx

These Web service interfaces make it very easy to integrate SharePoint capabilities right into your application.

Updating database using dataset

This topic illustrates how to update data in a database using a DataSet. It is important to remember that you can also insert, update, and delete data in a database directly using a SqlCommand.

Once the DataSet is loaded, you can modify the data, and the DataSet will track the changes.

The DataSet can be considered an in-memory cache of data retrieved from a database. The DataSet consists of a collection of tables, relationships, and constraints. In this example we will show how to use the Delete method on the DataSet to Delete rows from the database.The Database values are updated with those from Dataset using Update method of SqlDataAdapter

Below are some simple steps to preform  Delete operation on Dataset.

STEP  1 : Fill the Dataset with the data you required and bind it to grid.

STEP 2: To Delete a particular row from dataset we required its DatasetIndex, to know the DatasetIndex we perform the delete operation on Grid’s ItemCommand Event.

If e.CommandName = "Delete" Then
End If
dgUser.DataSource = UpdateDatabase(parentset, "OleDb")

STEP 3: Create a new instance of OleDbDataAdapter and pass the required parameters, you can either pass OleDbCommand object or write down the Sql statement alongwith the ConnectionString.

Create a instance of OleDbCommandBuilder, it is used to update the changes from Dataset to Database. The parameter required for OleDbCommandBuilder is OleDbDataAdapter with a SELECT Sql statement. The command builder will automatically generate INSERT,UPDATE & DELETE statements for the table and parameters used in SELECT statement.

Public Function UpdateDatabase(ByRef dataSet As DataSet, ByVal Provider As String) As DataSet
If Provider = "OleDb" Then
Dim dbAdapter As New OleDbDataAdapter("SELECT Sql Statement",ConnectionString)
Dim objCommandBldr As New OleDbCommandBuilder(dbAdapter)
ElseIf Provider = "SQL" Then
Dim sqlAdapter As New SqlDataAdapter("SELECT Sql Statement",ConnectionString)
Dim sqlCommandBuilder As New SqlCommandBuilder(sqlAdapter)
End If

Return dataSet

STEP 4: Build & Execute.

Here is the link to download the sample application which will demonstrate the above behavior.

You can also find a detailed explanation of Updating Database using Dataset over here.

Enjoy Coding and Keep Learning 🙂

Insert Code Snippet – Tip Of Week#1

Hi guys, do you know you can use already ready code inside your visual studio? Yes certainly you can insert code snippets into your code. You can invoke the “Insert Snippet” by using shortcut “ctrl k + ctrl x”

Using ParseQueryString to get QueryString Values

Following is the sample code you can use to parse your querystring and return NameValueCollection


protected void Page_Load(object sender, EventArgs e)
String currurl = HttpContext.Current.Request.RawUrl;
String querystring = null ;

// Check to make sure some query string variables
// exist and if not add some and redirect.
int iqs = currurl.IndexOf(‘?’);
if (iqs == -1)
String redirecturl = currurl + "?var1=1&var2=2+2%2f3&var1=3";
Response.Redirect(redirecturl, true);
// If query string variables exist, put them in
// a string.
else if (iqs >= 0)
querystring = (iqs < currurl.Length – 1) ? currurl.Substring(iqs + 1) : String.Empty;

// Parse the query string variables into a NameValueCollection.
NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring);

// Iterate through the collection.
StringBuilder sb = new StringBuilder("");
foreach (String s in qscoll.AllKeys)
sb.Append(s + " – " + qscoll[s] + "");

// Write the result to a label.
ParseOutput.Text = sb.ToString();



This is the front end code ,


<form id="form1" runat="server">
Query string variables are:
<asp:label id="ParseOutput" runat="server">


Hope this Helps 🙂

JQuery in Visual Studio

A big part of the appeal of jQuery is that it allows you to elegantly (and efficiently) find and manipulate HTML elements with minimum lines of code. jQuery supports this via a nice “selector” API that allows developers to query for HTML elements, and then apply “commands” to them. One of the characteristics of jQuery commands is that they can be “chained” together – so that the result of one command can feed into another. jQuery also includes a built-in set of animation APIs that can be used as commands. The combination allows you to do some really cool things with only a few keystrokes.

For example, the below JavaScript uses jQuery to find all <div> elements within a page that have a CSS class of “product”, and then animate them to slowly disappear:


As another example, the JavaScript below uses jQuery to find a specific <table> on the page with an id of “datagrid1”, then retrieves every other <tr> row within the datagrid, and sets those <tr> elements to have a CSS class of “even” – which could be used to alternate the background color of each row:

$(“#datagrid1 tr:nth-child(even)”).addClass(“even”);

The jQuery library also works well on the same page with ASP.NET AJAX and the ASP.NET AJAX Control Toolkit.

Visual Studio figures out external script references, such as to JQuery, by following special reference comments it finds at the top of .js files:

/// <reference path="jquery-1.2.3.js" />

You can download the JQuery from here. You can get more details on JQuery from .

For intellisense support for JQuery you need to install this Hotfix.

Comment for javascript is written inside for intellisense support. JavaScript has the interesting feature that calling toString on a function returns the code of this function including the comments and thus the doc comments. Here’s a similar example in JavaScript where the documentation is written inside of a class constructor:


Another difference with C# or VB.NET is that property and event accessors are two different entities in JavaScript. For this reason, to choose where the documentation should be for those members. Properties should be documented in the getter and events in the “adder” for this reason: