O'Reilly logo

SharePoint 2007: The Definitive Guide by Christopher J. Regan, Piotr Prussak, Christopher Pragash, Joris Poelmans, Nilesh Mehta, Jason Medero, Michael Lotter, Murray Gordon, Bob Fox, Christopher M. Buechler, James Pyles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Utilizing Web Services with Visual Studio

Consumption of Web Services is one of the strong points of Visual Studio. A typical Web Service consumer will be a command application, a desktop application, or a service. Other applications may require some additional security configuration in the code, so for the sake of simplicity, we'll focus on a standard desktop application calling Web Services.

Here, in just few lines of code, we'll be able to recreate the same functionality as in InfoPath and WebService Studio combined. As shown in Figure 26-10, we will use two Web Services to retrieve lists from the server, and then, once we obtain the GUID of each list, we will be able to retrieve data from the list.

  1. First, create a new Windows Application Project.

  2. Next, add references to the Web Services:

    1. Right-click the root node of the project in Solutions Explorer.

    2. Select Add Web Reference.

      Add Users in Policy for Web Application

      Figure 26-9. Add Users in Policy for Web Application

    3. In the Add Web Reference dialog box (Figure 26-11), you have to navigate to the Web Service you will utilize. If working with a local server, you can select the "Web Services on the Local Machine" link and navigate to the Lists Web Service; if working with another server, enter the URL of the Web Service. If you intend on binding to a specific web site within your portal, enter its full path, such as:

      	http://servername/sitepath/_vti_vin/Lists.asmx
      
    4. Next, when the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required