Home > SharePoint 2010, WCF > Using Console Application to Consume SharePoint web services

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:

  1. 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

  2. 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.

  3. The final step is to make application changes in the app.cofing file.

    You need to change from

    To

    
    

     

  4. Press F5 to run the application, it will produce the following result.

You can download the complete application from here.

References:

http://msdn.microsoft.com/en-us/library/ff462061.aspx

http://msdn.microsoft.com/en-us/library/ee705814.aspx

http://msdn.microsoft.com/en-us/library/ms479390%28v=office.12%29.aspx

Advertisements
Categories: SharePoint 2010, WCF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: