How to access SharePoint List with List Web Service

SharePoint List Web service allow developers to access, manipulate List and List items through a service url.

Generally List web service url format is : http://site/_vti_bin/lists.asmx

Now lest start consuming this service and manage SharePoint List.
Open this url:
Open Visual Studio 2010.
Right click on project and add service reference.

Then click on Advanced… (Refer below screen shot)

Click on Add web reference…

Enter service url and click
 on arrow ->
Give a name to the web reference name , click on Add Reference.
I gave SPSiteRef

Now write this in a console application:

SPSiteRef.ListsobjList = new Lists();
Lists listReference = newLists();      
listReference.Url = “http://spsite:1985/_vti_bin/lists.asmx”;
listReference.Credentials = CredentialCache.DefaultCredentials;
//To Add a List
listReference.AddList(“MyListtest”, “This is a list created by service”, 100);
//To Delete a list

Few more Methods are:

UpdateList, UpdateListItems, GetListItems ….

Please follow and like us:

Leave a Comment