Using Console Application to Consume SharePoint web services
When working with SharePoint2010 web services, the first thing you might do is to create a console application to test your idea. Now, I will show you how to create one to consume the SharePoint Lists Web Service. There are two ways of adding a service references, one is to add a service reference, and another way is to add a web reference. By adding a service reference, this will generate code based on latest .NET Framework Web Services technology (WCF) and by adding a web reference instead of a service reference. This will generate code based on .NET Framework 2.0 Web Services technology.If you like to call the same web service from Office 365 ,you can check my blog here.
To add a service reference, you need to do the following:
Open visual studio to create a console application then add service references. In the address textbox, type the SharePoint Lists Web Service URL in the format of http://<site>/_vti_bin/Lists.asmx
In the console app, write the following code to query the all the lists. You need to set the web services credentials as highlighted below.
The final step is to make application changes in the app.cofing file.
You need to change from
- Press F5 to run the application, it will produce the following result.
You can download the complete application from here.